From: tim Date: Tue, 13 Oct 2015 16:55:03 +0000 (+0000) Subject: Ignore the setuid/setgid/sticky bits when copying the permissions of an input X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=55c9c81446966ea275b75c50435002f640b68aa5;p=openbsd Ignore the setuid/setgid/sticky bits when copying the permissions of an input file to the new output file. In preparation for pledge(2). Suggested by and OK millert@ --- diff --git a/usr.bin/sort/sort.c b/usr.bin/sort/sort.c index bb0178cb90d..c0305db5d9c 100644 --- a/usr.bin/sort/sort.c +++ b/usr.bin/sort/sort.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sort.c,v 1.80 2015/10/13 16:21:42 tim Exp $ */ +/* $OpenBSD: sort.c,v 1.81 2015/10/13 16:55:03 tim Exp $ */ /*- * Copyright (C) 2009 Gabor Kovesdan @@ -1133,7 +1133,7 @@ main(int argc, char *argv[]) sort_asprintf(&outfile, "%s.XXXXXXXXXX", real_outfile); if ((fd = mkstemp(outfile)) == -1 || - fchmod(fd, sb.st_mode & ALLPERMS) == -1) + fchmod(fd, sb.st_mode & ACCESSPERMS) == -1) err(2, "%s", outfile); close(fd); tmp_file_atexit(outfile);