summaryrefslogtreecommitdiff
path: root/tests/getprogname.c
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff.email>2025-10-18 19:07:08 +0200
committerJörg Frings-Fürst <debian@jff.email>2025-10-18 19:07:08 +0200
commit693ae7b71dfdd1a8146266b5794a71c0dbe5dff0 (patch)
tree9704e2f7bd8962ea8911cd6f4e2d37227d7eff2e /tests/getprogname.c
parentb8b9b0ac61ac47dddc58717f23619f8b06640498 (diff)
parent27dae84ed92f1ef0300263091972338d12e78348 (diff)
Update upstream source from tag 'upstream/1.4.1'
Update to upstream version '1.4.1' with Debian dir 8add41ffbfe3e6636eec0ec134c5af96832cc143
Diffstat (limited to 'tests/getprogname.c')
-rw-r--r--tests/getprogname.c45
1 files changed, 3 insertions, 42 deletions
diff --git a/tests/getprogname.c b/tests/getprogname.c
index 392a9a2f..4da2159f 100644
--- a/tests/getprogname.c
+++ b/tests/getprogname.c
@@ -1,5 +1,5 @@
/* Program name management.
- Copyright (C) 2016-2024 Free Software Foundation, Inc.
+ Copyright (C) 2016-2025 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
@@ -42,14 +42,6 @@
# include <string.h>
#endif
-#if defined __sgi || defined __osf__
-# include <string.h>
-# include <unistd.h>
-# include <stdio.h>
-# include <fcntl.h>
-# include <sys/procfs.h>
-#endif
-
#if defined __SCO_VERSION__ || defined __sysv5__
# include <fcntl.h>
# include <string.h>
@@ -137,7 +129,7 @@ getprogname (void)
else
p = cmd;
if (strlen (p) > PST_UCOMMLEN - 1
- && memcmp (p, ucomm, PST_UCOMMLEN - 1) == 0)
+ && memeq (p, ucomm, PST_UCOMMLEN - 1))
/* p is less truncated than ucomm. */
;
else
@@ -173,7 +165,7 @@ getprogname (void)
else
p = cmd;
if (strlen (p) > PST_UCOMMLEN - 1
- && memcmp (p, ucomm, PST_UCOMMLEN - 1) == 0)
+ && memeq (p, ucomm, PST_UCOMMLEN - 1))
/* p is less truncated than ucomm. */
;
else
@@ -234,37 +226,6 @@ getprogname (void)
free (buf.ps_pathptr);
}
return p;
-# elif defined __sgi || defined __osf__ /* IRIX or Tru64 */
- char filename[50];
- int fd;
-
- # if defined __sgi
- sprintf (filename, "/proc/pinfo/%d", (int) getpid ());
- # else
- sprintf (filename, "/proc/%d", (int) getpid ());
- # endif
- fd = open (filename, O_RDONLY | O_CLOEXEC);
- if (0 <= fd)
- {
- prpsinfo_t buf;
- int ioctl_ok = 0 <= ioctl (fd, PIOCPSINFO, &buf);
- close (fd);
- if (ioctl_ok)
- {
- char *name = buf.pr_fname;
- size_t namesize = sizeof buf.pr_fname;
- /* It may not be NUL-terminated. */
- char *namenul = memchr (name, '\0', namesize);
- size_t namelen = namenul ? namenul - name : namesize;
- char *namecopy = malloc (namelen + 1);
- if (namecopy)
- {
- namecopy[namelen] = '\0';
- return memcpy (namecopy, name, namelen);
- }
- }
- }
- return NULL;
# elif defined __SCO_VERSION__ || defined __sysv5__ /* SCO OpenServer6/UnixWare */
char buf[80];
int fd;