commit | 1aa75118c46c8fbe0eeead18974d25e5f13274d5 | [log] [tgz] |
---|---|---|
author | Rob Landley <rob@landley.net> | Wed Aug 07 12:19:51 2013 -0500 |
committer | Rob Landley <rob@landley.net> | Wed Aug 07 12:19:51 2013 -0500 |
tree | 643b500aa234d17a8fc5cf1dad8d61e6fbb5aeae | |
parent | 17ea5644d93ff1ced28d3602ac244cb6022f3ba6 [diff] [blame] |
Forgot to check in xfdopen(). My bad. Failure of fdopen() is most likely failure of malloc() for the FILE structure.
diff --git a/lib/xwrap.c b/lib/xwrap.c index adf3e75..9f1dc99 100644 --- a/lib/xwrap.c +++ b/lib/xwrap.c
@@ -172,6 +172,15 @@ return fd; } +FILE *xfdopen(int fd, char *mode) +{ + FILE *f = fdopen(fd, mode); + + if (!f) perror_exit("xfdopen"); + + return f; +} + // Die unless we can open/create a file, returning FILE *. FILE *xfopen(char *path, char *mode) {