diff options
Diffstat (limited to 'wrudf/wrudf-cmnd.c')
-rw-r--r-- | wrudf/wrudf-cmnd.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/wrudf/wrudf-cmnd.c b/wrudf/wrudf-cmnd.c index bfa8136..e861d82 100644 --- a/wrudf/wrudf-cmnd.c +++ b/wrudf/wrudf-cmnd.c @@ -1097,12 +1097,17 @@ int questionOverwrite(Directory *dir, struct fileIdentDesc *fid, char* name) { printf("File %s already exists. Overwrite ? (y/N) : ", name); -#ifdef _GNU_SOURCE +#ifdef USE_READLINE readLine(NULL); #else - fgets(line, 256, stdin); + if (!fgets(line, 256, stdin)) + line[0] = 0; #endif - if( !line || line[0] != 'y' ) +#ifdef USE_READLINE + if( !line ) + return 1; +#endif + if( line[0] != 'y' ) return 1; deleteFID(dir, fid); return 0; |