NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: bin/56775: sort -o foo foo can sometines remove foo
The following reply was made to PR bin/56775; it has been noted by GNATS.
From: Thomas Klausner <wiz%NetBSD.org@localhost>
To: gnats-bugs%netbsd.org@localhost
Cc:
Subject: Re: bin/56775: sort -o foo foo can sometines remove foo
Date: Thu, 31 Mar 2022 21:19:06 +0200
On Thu, Mar 31, 2022 at 07:10:00PM +0000, rvp%SDF.ORG@localhost wrote:
> @@ -368,11 +368,8 @@
> outpath, outfile);
> }
>
> - (void)unlink(outpath);
> - if (link(outfile, outpath))
> - err(2, "cannot link %s: output left in %s",
> - outpath, outfile);
> - (void)unlink(outfile);
> + if (rename(outfile, outpath) == -1)
> + err(2, "rename failed: %s->%s", outfile, outpath);
> toutpath[0] = 0;
> }
> exit(0);
>
Shouldn't the there be an
unlink(outfile);
in the error case?
Thomas
Home |
Main Index |
Thread Index |
Old Index