pinosaur
/
smdp.git
/ commitdiff
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
cf34c7f
)
error handling for freopen()
author
Michael Göhler
<somebody.here@gmx.de>
Sun, 21 Sep 2014 12:12:29 +0000
(14:12 +0200)
committer
Michael Göhler
<somebody.here@gmx.de>
Sun, 21 Sep 2014 12:12:29 +0000
(14:12 +0200)
mdp.c
patch
|
blob
|
history
diff --git
a/mdp.c
b/mdp.c
index
3bf1bd2
..
3d38e3f
100644
(file)
--- a/
mdp.c
+++ b/
mdp.c
@@
-109,8
+109,13
@@
int main(int argc, char *argv[]) {
fclose(input);
// replace stdin with current tty if input was a pipe
- if(input == stdin)
- freopen("/dev/tty", "rw", stdin);
+ if(input == stdin) {
+ input = freopen("/dev/tty", "rw", stdin);
+ if(!input) {
+ fprintf(stderr, "%s: %s: %s\n", argv[0], "/dev/tty", strerror(errno));
+ exit(EXIT_FAILURE);
+ }
+ }
if(debug > 0) {
markdown_debug(deck, debug);