From f01a84e65fe1c0f2ccc8cea4668c382a92cf81b2 Mon Sep 17 00:00:00 2001 From: millert Date: Sun, 18 Oct 2015 17:02:03 +0000 Subject: [PATCH] Do not warn for sort -o if we can't chown the output temporary file to match the owner of the output file. --- usr.bin/sort/sort.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/usr.bin/sort/sort.c b/usr.bin/sort/sort.c index fe11144874f..9b61cbe74fe 100644 --- a/usr.bin/sort/sort.c +++ b/usr.bin/sort/sort.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sort.c,v 1.83 2015/10/17 14:33:01 tim Exp $ */ +/* $OpenBSD: sort.c,v 1.84 2015/10/18 17:02:03 millert Exp $ */ /*- * Copyright (C) 2009 Gabor Kovesdan @@ -1107,12 +1107,10 @@ main(int argc, char *argv[]) sort_asprintf(&outfile, "%s.XXXXXXXXXX", real_outfile); if ((fd = mkstemp(outfile)) == -1) - err(2, "mkstemp: %s", outfile); - if (fchown(fd, sb.st_uid, sb.st_gid) == -1) - warn("unable to set ownership of %s", - outfile); + err(2, "%s", outfile); + (void)fchown(fd, sb.st_uid, sb.st_gid); if (fchmod(fd, sb.st_mode & ACCESSPERMS) == -1) - err(2, "fchmod: %s", outfile); + err(2, "%s", outfile); close(fd); tmp_file_atexit(outfile); break; -- 2.20.1