pkgsrc-Changes archive

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

CVS commit: pkgsrc/pkgtools/pkg_install/files/add



Module Name:    pkgsrc
Committed By:   martin
Date:           Sat Dec  7 13:20:14 UTC 2024

Modified Files:
        pkgsrc/pkgtools/pkg_install/files/add: perform.c

Log Message:
PR 58809: save and restore current working directory when installing
libraries.


To generate a diff of this commit:
cvs rdiff -u -r1.126 -r1.127 pkgsrc/pkgtools/pkg_install/files/add/perform.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: pkgsrc/pkgtools/pkg_install/files/add/perform.c
diff -u pkgsrc/pkgtools/pkg_install/files/add/perform.c:1.126 pkgsrc/pkgtools/pkg_install/files/add/perform.c:1.127
--- pkgsrc/pkgtools/pkg_install/files/add/perform.c:1.126       Fri Nov  1 11:26:46 2024
+++ pkgsrc/pkgtools/pkg_install/files/add/perform.c     Sat Dec  7 13:20:14 2024
@@ -1,4 +1,4 @@
-/*     $NetBSD: perform.c,v 1.126 2024/11/01 11:26:46 riastradh Exp $  */
+/*     $NetBSD: perform.c,v 1.127 2024/12/07 13:20:14 martin Exp $     */
 #if HAVE_CONFIG_H
 #include "config.h"
 #endif
@@ -6,7 +6,7 @@
 #if HAVE_SYS_CDEFS_H
 #include <sys/cdefs.h>
 #endif
-__RCSID("$NetBSD: perform.c,v 1.126 2024/11/01 11:26:46 riastradh Exp $");
+__RCSID("$NetBSD: perform.c,v 1.127 2024/12/07 13:20:14 martin Exp $");
 
 /*-
  * Copyright (c) 2003 Grant Beattie <grant%NetBSD.org@localhost>
@@ -693,6 +693,7 @@ extract_files(struct pkg_task *pkg)
        plist_t *p;
        const char *last_file;
        char *fullpath;
+       int workdir;
 
        if (Fake)
                return 0;
@@ -707,6 +708,12 @@ extract_files(struct pkg_task *pkg)
                return -1;
        }
 
+       workdir = open(".", O_RDONLY|O_CLOEXEC|O_DIRECTORY);
+       if (workdir == -1) {
+               warn("Can't open current working directory");
+               return -1;
+       }
+
        if (chdir(pkg->install_prefix) == -1) {
                warn("Can't change into prefix: %s", pkg->install_prefix);
                return -1;
@@ -833,6 +840,9 @@ out:
                pkgdb_close();
        archive_write_free(writer);
 
+       fchdir(workdir);
+       close(workdir);
+
        return r;
 }
 



Home | Main Index | Thread Index | Old Index