X-Git-Url: https://git.cworth.org/git?p=ttt;a=blobdiff_plain;f=src%2Fx.c;h=3e46abdd03fb0c388c60d5494cce359cdcaf2cc6;hp=1695374c8c72a3c6423a69b69d15728c575055ee;hb=49f7f9e3dc198c3593021bff5514f19090a4834c;hpb=2cd70db8433cc9d02a4ca784190260889c835198 diff --git a/src/x.c b/src/x.c index 1695374..3e46abd 100644 --- a/src/x.c +++ b/src/x.c @@ -127,7 +127,23 @@ xfdopen (int filedes, const char *mode) ret = fdopen (filedes, mode); if (ret == NULL) { - fprintf (stderr, "Error: fdopen failed: %s. Aborting.\n", strerror (errno)); + fprintf (stderr, "Error: fdopen failed: %s. Aborting.\n", + strerror (errno)); + exit (1); + } + + return ret; +} + +FILE * +xfreopen (const char *path, const char *mode, FILE *stream) +{ + FILE *ret; + + ret = freopen (path, mode, stream); + if (ret == NULL) { + fprintf (stderr, "Error: freopen of %s failed: %s. Aborting.\n", + path, strerror (errno)); exit (1); }