diff options
Diffstat (limited to 'openbsd-compat/bsd-misc.c')
-rw-r--r-- | openbsd-compat/bsd-misc.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/openbsd-compat/bsd-misc.c b/openbsd-compat/bsd-misc.c index 65e800397..f7be415ec 100644 --- a/openbsd-compat/bsd-misc.c +++ b/openbsd-compat/bsd-misc.c | |||
@@ -31,8 +31,6 @@ | |||
31 | #include <time.h> | 31 | #include <time.h> |
32 | #include <unistd.h> | 32 | #include <unistd.h> |
33 | 33 | ||
34 | #include "xmalloc.h" | ||
35 | |||
36 | #ifndef HAVE___PROGNAME | 34 | #ifndef HAVE___PROGNAME |
37 | char *__progname; | 35 | char *__progname; |
38 | #endif | 36 | #endif |
@@ -43,13 +41,12 @@ char *__progname; | |||
43 | */ | 41 | */ |
44 | char *ssh_get_progname(char *argv0) | 42 | char *ssh_get_progname(char *argv0) |
45 | { | 43 | { |
44 | char *p, *q; | ||
46 | #ifdef HAVE___PROGNAME | 45 | #ifdef HAVE___PROGNAME |
47 | extern char *__progname; | 46 | extern char *__progname; |
48 | 47 | ||
49 | return xstrdup(__progname); | 48 | p = __progname; |
50 | #else | 49 | #else |
51 | char *p; | ||
52 | |||
53 | if (argv0 == NULL) | 50 | if (argv0 == NULL) |
54 | return ("unknown"); /* XXX */ | 51 | return ("unknown"); /* XXX */ |
55 | p = strrchr(argv0, '/'); | 52 | p = strrchr(argv0, '/'); |
@@ -57,9 +54,12 @@ char *ssh_get_progname(char *argv0) | |||
57 | p = argv0; | 54 | p = argv0; |
58 | else | 55 | else |
59 | p++; | 56 | p++; |
60 | |||
61 | return (xstrdup(p)); | ||
62 | #endif | 57 | #endif |
58 | if ((q = strdup(p)) == NULL) { | ||
59 | perror("strdup"); | ||
60 | exit(1); | ||
61 | } | ||
62 | return q; | ||
63 | } | 63 | } |
64 | 64 | ||
65 | #ifndef HAVE_SETLOGIN | 65 | #ifndef HAVE_SETLOGIN |