=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/xinstall/xinstall.c,v retrieving revision 1.27 retrieving revision 1.28 diff -c -r1.27 -r1.28 *** src/usr.bin/xinstall/xinstall.c 2001/07/09 07:04:58 1.27 --- src/usr.bin/xinstall/xinstall.c 2001/08/25 19:52:05 1.28 *************** *** 1,4 **** ! /* $OpenBSD: xinstall.c,v 1.27 2001/07/09 07:04:58 deraadt Exp $ */ /* $NetBSD: xinstall.c,v 1.9 1995/12/20 10:25:17 jonathan Exp $ */ /* --- 1,4 ---- ! /* $OpenBSD: xinstall.c,v 1.28 2001/08/25 19:52:05 heko Exp $ */ /* $NetBSD: xinstall.c,v 1.9 1995/12/20 10:25:17 jonathan Exp $ */ /* *************** *** 44,50 **** #if 0 static char sccsid[] = "@(#)xinstall.c 8.1 (Berkeley) 7/21/93"; #endif ! static char rcsid[] = "$OpenBSD: xinstall.c,v 1.27 2001/07/09 07:04:58 deraadt Exp $"; #endif /* not lint */ #include --- 44,50 ---- #if 0 static char sccsid[] = "@(#)xinstall.c 8.1 (Berkeley) 7/21/93"; #endif ! static char rcsid[] = "$OpenBSD: xinstall.c,v 1.28 2001/08/25 19:52:05 heko Exp $"; #endif /* not lint */ #include *************** *** 354,360 **** char backup[MAXPATHLEN]; (void)snprintf(backup, MAXPATHLEN, "%s%s", to_name, suffix); ! if (rename(to_name, backup) < 0) { serrno = errno; unlink(tempfile); errx(EX_OSERR, "rename: %s to %s: %s", to_name, --- 354,361 ---- char backup[MAXPATHLEN]; (void)snprintf(backup, MAXPATHLEN, "%s%s", to_name, suffix); ! /* It is ok for the target file not to exist. */ ! if (rename(to_name, backup) < 0 && errno != ENOENT) { serrno = errno; unlink(tempfile); errx(EX_OSERR, "rename: %s to %s: %s", to_name, *************** *** 662,669 **** if (dobackup) { (void)snprintf(backup, MAXPATHLEN, "%s%s", path, suffix); ! if (rename(path, backup) < 0) ! err(EX_OSERR, "rename: %s to %s", path, backup); } else (void)unlink(path); --- 663,671 ---- if (dobackup) { (void)snprintf(backup, MAXPATHLEN, "%s%s", path, suffix); ! /* It is ok for the target file not to exist. */ ! if (rename(path, backup) < 0 && errno != ENOENT) ! err(EX_OSERR, "rename: %s to %s (errno %d)", path, backup, errno); } else (void)unlink(path);