pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/pkgtools/pkg_install/files/add When rename(2) fails, i...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/c025cfd9ce4c
branches:  trunk
changeset: 534830:c025cfd9ce4c
user:      rillig <rillig%pkgsrc.org@localhost>
date:      Thu Nov 01 21:57:37 2007 +0000

description:
When rename(2) fails, it is useful to know some details about the
filenames that have been involved.

Do not use assert() for error checking.

diffstat:

 pkgtools/pkg_install/files/add/perform.c |  9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diffs (37 lines):

diff -r b39a605ae43a -r c025cfd9ce4c pkgtools/pkg_install/files/add/perform.c
--- a/pkgtools/pkg_install/files/add/perform.c  Thu Nov 01 21:32:06 2007 +0000
+++ b/pkgtools/pkg_install/files/add/perform.c  Thu Nov 01 21:57:37 2007 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: perform.c,v 1.63 2007/09/11 13:39:05 rillig Exp $      */
+/*     $NetBSD: perform.c,v 1.64 2007/11/01 21:57:37 rillig Exp $      */
 
 #if HAVE_CONFIG_H
 #include "config.h"
@@ -14,7 +14,7 @@
 #if 0
 static const char *rcsid = "from FreeBSD Id: perform.c,v 1.44 1997/10/13 15:03:46 jkh Exp";
 #else
-__RCSID("$NetBSD: perform.c,v 1.63 2007/09/11 13:39:05 rillig Exp $");
+__RCSID("$NetBSD: perform.c,v 1.64 2007/11/01 21:57:37 rillig Exp $");
 #endif
 #endif
 
@@ -357,7 +357,7 @@
                if (Verbose)
                        printf("mv %s %s\n", replace_from, replace_via);                                                
                if (rename(replace_from, replace_via) != 0)
-                       err(EXIT_FAILURE, "rename failed");
+                       err(EXIT_FAILURE, "renaming %s to %s failed", replace_from, replace_via);
 
                *replacing = 1;
        }
@@ -983,7 +983,8 @@
                 * (see also step 2/4)
                 */
                rc = rename(replace_via, replace_to);
-               assert(rc == 0);
+               if (rc != 0)
+                       err(EXIT_FAILURE, "renaming %s to %s failed", replace_via, replace_to);
                
                /*
                 * Upgrade step 4/4: Fix pkgs that depend on us to



Home | Main Index | Thread Index | Old Index