diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-08-07 13:31:20 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-08-07 13:31:20 +0000 |
commit | 73d83372ecc1cfc9458fdfdd4bfc591fbe860bca (patch) | |
tree | 7ff966e35d1a7105568b835f5b5a19b87045c558 /lib | |
parent | Adding upstream version 1.22.7. (diff) | |
download | dpkg-73d83372ecc1cfc9458fdfdd4bfc591fbe860bca.tar.xz dpkg-73d83372ecc1cfc9458fdfdd4bfc591fbe860bca.zip |
Adding upstream version 1.22.8.upstream/1.22.8
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/dpkg/Makefile.am | 1 | ||||
-rw-r--r-- | lib/dpkg/Makefile.in | 3 | ||||
-rw-r--r-- | lib/dpkg/execname.c | 26 | ||||
-rw-r--r-- | lib/dpkg/libdpkg.pc.in | 2 |
4 files changed, 27 insertions, 5 deletions
diff --git a/lib/dpkg/Makefile.am b/lib/dpkg/Makefile.am index 862562c..dcf3d46 100644 --- a/lib/dpkg/Makefile.am +++ b/lib/dpkg/Makefile.am @@ -48,6 +48,7 @@ EXTRA_libdpkg_la_DEPENDENCIES += \ endif libdpkg_la_LIBADD = \ + $(PS_LIBS) \ $(Z_LIBS) \ $(LZMA_LIBS) \ $(ZSTD_LIBS) \ diff --git a/lib/dpkg/Makefile.in b/lib/dpkg/Makefile.in index 3c92b54..48a72d1 100644 --- a/lib/dpkg/Makefile.in +++ b/lib/dpkg/Makefile.in @@ -191,7 +191,7 @@ am__DEPENDENCIES_1 = libdpkg_la_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ - ../compat/libcompat.la + $(am__DEPENDENCIES_1) ../compat/libcompat.la am_libdpkg_la_OBJECTS = ar.lo arch.lo atomic-file.lo buffer.lo \ c-ctype.lo cleanup.lo color.lo command.lo compress.lo dbdir.lo \ dbmodify.lo db-ctrl-access.lo db-ctrl-format.lo \ @@ -793,6 +793,7 @@ devlib_LTLIBRARIES = libdpkg.la EXTRA_libdpkg_la_DEPENDENCIES = libdpkg.map $(am__append_3) libdpkg_la_LDFLAGS = -no-undefined $(am__append_1) $(am__append_2) libdpkg_la_LIBADD = \ + $(PS_LIBS) \ $(Z_LIBS) \ $(LZMA_LIBS) \ $(ZSTD_LIBS) \ diff --git a/lib/dpkg/execname.c b/lib/dpkg/execname.c index 6529fcf..b43ab99 100644 --- a/lib/dpkg/execname.c +++ b/lib/dpkg/execname.c @@ -37,12 +37,19 @@ #include <stdio.h> #include <unistd.h> +#if defined(__GNU__) +#include <hurd.h> +#include <ps.h> +#endif + #if defined(__APPLE__) && defined(__MACH__) #include <libproc.h> #endif #include <dpkg/dpkg.h> +#if defined(__sun) #include <dpkg/file.h> +#endif #include <dpkg/execname.h> #if defined(_AIX) && defined(HAVE_STRUCT_PSINFO) @@ -96,15 +103,26 @@ dpkg_get_pid_execname(pid_t pid) lcontents[nread] = '\0'; execname = lcontents; #elif defined(__GNU__) + struct ps_context *pc; struct proc_stat *ps; + error_t err; + + if (pid < 0) + return NULL; + + err = ps_context_create(getproc(), &pc); + if (err) + return NULL; - ps = get_proc_stat(pid, PSTAT_ARGS); - if (ps == NULL) + err = ps_context_find_proc_stat(pc, pid, &ps); + if (err) return NULL; /* On old Hurd systems we have to use the argv[0] value, because * there is nothing better. */ - execname = proc_stat_args(ps); + if (proc_stat_set_flags(ps, PSTAT_ARGS) == 0 && + (proc_stat_flags(ps) & PSTAT_ARGS)) + execname = proc_stat_args(ps); #ifdef PSTAT_EXE /* On new Hurd systems we can use the correct value, as long @@ -116,6 +134,8 @@ dpkg_get_pid_execname(pid_t pid) proc_stat_exe(ps)[0] != '\0') execname = proc_stat_exe(ps); #endif + + ps_context_free(pc); #elif defined(__sun) char filename[64]; struct varbuf vb = VARBUF_INIT; diff --git a/lib/dpkg/libdpkg.pc.in b/lib/dpkg/libdpkg.pc.in index 1a91594..b658d59 100644 --- a/lib/dpkg/libdpkg.pc.in +++ b/lib/dpkg/libdpkg.pc.in @@ -7,5 +7,5 @@ Name: libdpkg Description: Debian package management system library Version: @VERSION@ Libs: -L${libdir} -ldpkg -Libs.private: @MD_LIBS@ @Z_LIBS@ @LZMA_LIBS@ @ZSTD_LIBS@ @BZ2_LIBS@ +Libs.private: @PS_LIBS@ @MD_LIBS@ @Z_LIBS@ @LZMA_LIBS@ @ZSTD_LIBS@ @BZ2_LIBS@ Cflags: -I${includedir} |