diff options
author | Wayne Davison <wayned@users.sourceforge.net> | 2009-03-15 01:04:50 +0000 |
---|---|---|
committer | Wayne Davison <wayned@users.sourceforge.net> | 2009-03-15 01:04:50 +0000 |
commit | bf25c3a43f79f568b55c45e2701f5c961977b47c (patch) | |
tree | eacd272cd739c11b793aa5788bba21fdc6d1205e /Src/Modules/zftp.c | |
parent | f0bcd0ecd0896180c5a3f977e086f7237a774d25 (diff) | |
download | zsh-bf25c3a43f79f568b55c45e2701f5c961977b47c.tar.gz zsh-bf25c3a43f79f568b55c45e2701f5c961977b47c.tar.xz zsh-bf25c3a43f79f568b55c45e2701f5c961977b47c.zip |
26735: Check some function return values for failures. Gets rid of
some compiler warnings, and improves error handling/notification.
Diffstat (limited to 'Src/Modules/zftp.c')
-rw-r--r-- | Src/Modules/zftp.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/Src/Modules/zftp.c b/Src/Modules/zftp.c index 12a9f0de2..0dc94866a 100644 --- a/Src/Modules/zftp.c +++ b/Src/Modules/zftp.c @@ -2043,8 +2043,9 @@ zfgetinfo(char *prompt, int noecho) fflush(stderr); } - fgets(instr, 256, stdin); - if (instr[len = strlen(instr)-1] == '\n') + if (fgets(instr, 256, stdin) == NULL) + instr[len = 0] = '\0'; + else if (instr[len = strlen(instr)-1] == '\n') instr[len] = '\0'; strret = dupstring(instr); |