diff options
| -rw-r--r-- | printutils/lpd.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/printutils/lpd.c b/printutils/lpd.c index ce5944026..e48feef90 100644 --- a/printutils/lpd.c +++ b/printutils/lpd.c | |||
| @@ -133,6 +133,8 @@ int lpd_main(int argc UNUSED_PARAM, char *argv[]) | |||
| 133 | 133 | ||
| 134 | // read command | 134 | // read command |
| 135 | s = queue = xmalloc_read_stdin(); | 135 | s = queue = xmalloc_read_stdin(); |
| 136 | if (!s) // eof? | ||
| 137 | return EXIT_FAILURE; | ||
| 136 | // we understand only "receive job" command | 138 | // we understand only "receive job" command |
| 137 | if (2 != *queue) { | 139 | if (2 != *queue) { |
| 138 | unsupported_cmd: | 140 | unsupported_cmd: |
| @@ -204,7 +206,7 @@ int lpd_main(int argc UNUSED_PARAM, char *argv[]) | |||
| 204 | } | 206 | } |
| 205 | 207 | ||
| 206 | // validate input. | 208 | // validate input. |
| 207 | // we understand only "control file" or "data file" cmds | 209 | // we understand only "control file" or "data file" subcmds |
| 208 | if (2 != s[0] && 3 != s[0]) | 210 | if (2 != s[0] && 3 != s[0]) |
| 209 | goto unsupported_cmd; | 211 | goto unsupported_cmd; |
| 210 | if (spooling & (1 << (s[0]-1))) { | 212 | if (spooling & (1 << (s[0]-1))) { |
| @@ -291,7 +293,7 @@ int lpd_main(int argc UNUSED_PARAM, char *argv[]) | |||
| 291 | err_exit: | 293 | err_exit: |
| 292 | // don't keep corrupted files | 294 | // don't keep corrupted files |
| 293 | if (spooling) { | 295 | if (spooling) { |
| 294 | #define i spooling | 296 | int i; |
| 295 | for (i = 2; --i >= 0; ) | 297 | for (i = 2; --i >= 0; ) |
| 296 | if (filenames[i]) | 298 | if (filenames[i]) |
| 297 | unlink(filenames[i]); | 299 | unlink(filenames[i]); |
