mirror of
https://https.git.savannah.gnu.org/git/patch.git
synced 2026-01-27 01:44:34 +00:00
Move error reporting out of make_tempfile()
* src/util.c (make_tempfile): Remove error reporting here. * src/inp.c (plan_b): Readd error reporting here. * src/patch.c (main): Likewise. * src/pch.c (open_patch_file): Likewise.
This commit is contained in:
parent
d55ab5b941
commit
c5da382c0b
@ -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;
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user