diff options
author | wtc%netscape.com <devnull@localhost> | 2003-03-21 20:57:07 +0000 |
---|---|---|
committer | wtc%netscape.com <devnull@localhost> | 2003-03-21 20:57:07 +0000 |
commit | c411edd5ef84d2acd0b6cec28ba4491a2108d254 (patch) | |
tree | b5764fb410a66b775d7418626ab279ac87689216 | |
parent | e466a5017d45950cb98db705cbe307b952aa8f1f (diff) | |
download | nss-hg-c411edd5ef84d2acd0b6cec28ba4491a2108d254.tar.gz |
Rewrote without the dirname() and basename() calls because they are not
available on some Unix platforms (e.g., BSD/OS 4.2).
-rw-r--r-- | security/nss/cmd/shlibsign/Makefile | 4 | ||||
-rw-r--r-- | security/nss/cmd/shlibsign/shlibsign.c | 27 |
2 files changed, 17 insertions, 14 deletions
diff --git a/security/nss/cmd/shlibsign/Makefile b/security/nss/cmd/shlibsign/Makefile index 2495930b8..84b6129c4 100644 --- a/security/nss/cmd/shlibsign/Makefile +++ b/security/nss/cmd/shlibsign/Makefile @@ -60,10 +60,6 @@ else IS_WINDOWS="NO" endif -ifeq ($(OS_TARGET), IRIX) - OS_LIBS += -lgen -endif - # # we really should have this driven from a list file made during the normal # NSS build prodecure. diff --git a/security/nss/cmd/shlibsign/shlibsign.c b/security/nss/cmd/shlibsign/shlibsign.c index 4653f97ae..566c91214 100644 --- a/security/nss/cmd/shlibsign/shlibsign.c +++ b/security/nss/cmd/shlibsign/shlibsign.c @@ -55,7 +55,6 @@ #include "pk11pqg.h" #ifdef USES_LINKS -#include <libgen.h> #include <unistd.h> #include <sys/param.h> #include <sys/types.h> @@ -258,7 +257,7 @@ main (int argc, char **argv) goto loser; } if (S_ISLNK(stat_buf.st_mode)) { - char *path,*dirpath; + char *dirpath,*dirend; ret = readlink(input_file, link_buf, sizeof(link_buf) - 1); if (ret < 0) { perror(input_file); @@ -266,16 +265,24 @@ main (int argc, char **argv) } link_buf[ret] = 0; link_file = mkoutput(input_file); - path = PORT_Strdup(input_file); - dirpath = dirname(path); - ret = chdir(dirpath); - if (ret < 0) { - perror(dirpath); - goto loser; + /* get the dirname of input_file */ + dirpath = PORT_Strdup(input_file); + dirend = PORT_Strrchr(dirpath, '/'); + if (dirend) { + *dirend = '\0'; + ret = chdir(dirpath); + if (ret < 0) { + perror(dirpath); + goto loser; + } } - PORT_Free(path); + PORT_Free(dirpath); input_file = link_buf; - link_file = basename(link_file); + /* get the basename of link_file */ + dirend = PORT_Strrchr(link_file, '/'); + if (dirend) { + link_file = dirend + 1; + } } #endif if (output_file == NULL) { |