=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/xinstall/xinstall.c,v retrieving revision 1.51 retrieving revision 1.52 diff -c -r1.51 -r1.52 *** src/usr.bin/xinstall/xinstall.c 2012/04/11 14:19:35 1.51 --- src/usr.bin/xinstall/xinstall.c 2012/09/14 00:00:29 1.52 *************** *** 1,4 **** ! /* $OpenBSD: xinstall.c,v 1.51 2012/04/11 14:19:35 millert Exp $ */ /* $NetBSD: xinstall.c,v 1.9 1995/12/20 10:25:17 jonathan Exp $ */ /* --- 1,4 ---- ! /* $OpenBSD: xinstall.c,v 1.52 2012/09/14 00:00:29 millert Exp $ */ /* $NetBSD: xinstall.c,v 1.9 1995/12/20 10:25:17 jonathan Exp $ */ /* *************** *** 235,240 **** --- 235,245 ---- docompare = 0; } + if (!devnull) { + if ((from_fd = open(from_name, O_RDONLY, 0)) < 0) + err(EX_OSERR, "%s", from_name); + } + if (safecopy) { to_fd = create_tempfile(to_name, tempfile, sizeof(tempfile)); if (to_fd < 0) *************** *** 248,259 **** } if (!devnull) { - if ((from_fd = open(from_name, O_RDONLY, 0)) < 0) { - serrno = errno; - (void)unlink(safecopy ? tempfile : to_name); - errx(EX_OSERR, "%s: %s", from_name, strerror(serrno)); - } - if (docompare && !safecopy) { files_match = !(compare(from_fd, from_name, (size_t)from_sb.st_size, to_fd, --- 253,258 ---- *************** *** 643,649 **** } else (void)unlink(path); ! return(open(path, O_CREAT | O_RDWR | O_TRUNC, S_IRUSR | S_IWUSR)); } /* --- 642,648 ---- } else (void)unlink(path); ! return(open(path, O_CREAT | O_RDWR | O_EXCL, S_IRUSR | S_IWUSR)); } /*