made error handling more proper
a98b5e59
1 file(s) · +7 −2
| 1302 | 1302 | if(FD_ISSET(STDIN_FILENO, &rd)) { |
|
| 1303 | 1303 | if(stext == fgets(stext, sizeof stext - 1, stdin)) |
|
| 1304 | 1304 | stext[strlen(stext) - 1] = '\0'; /* remove tailing '\n' */ |
|
| 1305 | - | else |
|
| 1306 | - | strncpy(stext, strerror(errno), sizeof stext - 1); |
|
| 1305 | + | else { |
|
| 1306 | + | readin = False; |
|
| 1307 | + | if(feof(stdin)) |
|
| 1308 | + | strncpy(stext, "EOF", 4); |
|
| 1309 | + | else /* error occured */ |
|
| 1310 | + | strncpy(stext, strerror(errno), sizeof stext - 1); |
|
| 1311 | + | } |
|
| 1307 | 1312 | drawbar(); |
|
| 1308 | 1313 | } |
|
| 1309 | 1314 | while(XPending(dpy)) { |