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: Mon Jan 13 11:16:19 UTC 2025
Modified Files:
pkgsrc/pkgtools/pkg_install/files/add: perform.c
Log Message:
PR 58809: save current directory before adding pkgs and restore
it afterwards.
To generate a diff of this commit:
cvs rdiff -u -r1.128 -r1.129 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.128 pkgsrc/pkgtools/pkg_install/files/add/perform.c:1.129
--- pkgsrc/pkgtools/pkg_install/files/add/perform.c:1.128 Sat Dec 7 13:56:46 2024
+++ pkgsrc/pkgtools/pkg_install/files/add/perform.c Mon Jan 13 11:16:19 2025
@@ -1,4 +1,4 @@
-/* $NetBSD: perform.c,v 1.128 2024/12/07 13:56:46 martin Exp $ */
+/* $NetBSD: perform.c,v 1.129 2025/01/13 11:16:19 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.128 2024/12/07 13:56:46 martin Exp $");
+__RCSID("$NetBSD: perform.c,v 1.129 2025/01/13 11:16:19 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,15 @@ extract_files(struct pkg_task *pkg)
return -1;
}
+#ifndef O_DIRECTORY
+#define O_DIRECTORY 0
+#endif
+ 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 +843,9 @@ out:
pkgdb_close();
archive_write_free(writer);
+ fchdir(workdir);
+ close(workdir);
+
return r;
}
Home |
Main Index |
Thread Index |
Old Index