pkgsrc-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: bin/58809: pkg_add gets confused with -P and library installs
The following reply was made to PR pkg/58809; it has been noted by GNATS.
From: Martin Husemann <martin%duskware.de@localhost>
To: gnats-bugs%netbsd.org@localhost
Cc:
Subject: Re: bin/58809: pkg_add gets confused with -P and library installs
Date: Thu, 2 Jan 2025 20:46:56 +0100
Like this?
Martin
Index: perform.c
===================================================================
RCS file: /cvsroot/pkgsrc/pkgtools/pkg_install/files/add/perform.c,v
retrieving revision 1.128
diff -u -p -r1.128 perform.c
--- perform.c 7 Dec 2024 13:56:46 -0000 1.128
+++ perform.c 2 Jan 2025 19:43:18 -0000
@@ -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