diff options
-rw-r--r-- | src/inp.c | 2 | ||||
-rw-r--r-- | src/patch.c | 4 | ||||
-rw-r--r-- | src/pch.c | 5 | ||||
-rw-r--r-- | src/util.c | 2 |
4 files changed, 10 insertions, 3 deletions
@@ -365,6 +365,8 @@ plan_b (char const *filename) { tifd = make_tempfile (&TMPINNAME, 'i', NULL, O_RDWR | O_BINARY, S_IRUSR | S_IWUSR); + if (tifd == -1) + pfatal ("Can't create temporary file %s", TMPINNAME); TMPINNAME_needs_removal = true; } i = 0; diff --git a/src/patch.c b/src/patch.c index 6b41f79..42d0267 100644 --- a/src/patch.c +++ b/src/patch.c @@ -309,6 +309,8 @@ main (int argc, char **argv) outfd = make_tempfile (&TMPOUTNAME, 'o', outname, O_WRONLY | binary_transput, instat.st_mode & S_IRWXUGO); + if (outfd == -1) + pfatal ("Can't create temporary file %s", TMPOUTNAME); TMPOUTNAME_needs_removal = true; if (diff_type == ED_DIFF) { outstate.zero_output = false; @@ -1586,6 +1588,8 @@ init_reject (char const *outname) int fd; fd = make_tempfile (&TMPREJNAME, 'r', outname, O_WRONLY | binary_transput, 0666); + if (fd == -1) + pfatal ("Can't create temporary file %s", TMPREJNAME); TMPREJNAME_needs_removal = true; rejfp = fdopen (fd, binary_transput ? "wb" : "w"); if (! rejfp) @@ -138,8 +138,11 @@ open_patch_file (char const *filename) else { size_t charsread; - int fd = make_tempfile (&TMPPATNAME, 'p', NULL, O_RDWR | O_BINARY, 0); + int fd; FILE *read_pfp = pfp; + fd = make_tempfile (&TMPPATNAME, 'p', NULL, O_RDWR | O_BINARY, 0); + if (fd == -1) + pfatal ("Can't create temporary file %s", TMPPATNAME); TMPPATNAME_needs_removal = true; pfp = fdopen (fd, "w+b"); if (! pfp) @@ -1660,8 +1660,6 @@ make_tempfile (char const **name, char letter, char const *real_name, sprintf (template, "%s/p%cXXXXXX", tmpdir, letter); } fd = try_tempname(template, 0, &args, try_safe_open); - if (fd == -1) - pfatal ("Can't create temporary file %s", template); *name = template; return fd; } |