projects
/
routeros-api.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
dabd10b
)
src/ros.c: Check the return value of fgets().
author
Florian Forster
<ff@octo.it>
Wed, 24 Jul 2013 11:44:56 +0000
(13:44 +0200)
committer
Florian Forster
<ff@octo.it>
Wed, 24 Jul 2013 11:45:48 +0000
(13:45 +0200)
Some compilers are unhappy when this return value is ignored.
src/ros.c
patch
|
blob
|
history
diff --git
a/src/ros.c
b/src/ros.c
index
605c6b7
..
1d638b6
100644
(file)
--- a/
src/ros.c
+++ b/
src/ros.c
@@
-243,7
+243,12
@@
static char *read_password (void) /* {{{ */
return (NULL);
}
- fgets (buffer, sizeof (buffer), tty);
+ if (fgets (buffer, sizeof (buffer), tty) == NULL)
+ {
+ fprintf (stderr, "fgets failed: %s\n", strerror (errno));
+ fclose (tty);
+ return (NULL);
+ }
buffer[sizeof (buffer) - 1] = 0;
buffer_len = strlen (buffer);