summaryrefslogtreecommitdiff
path: root/openbsd-compat/bsd-misc.c
diff options
context:
space:
mode:
authorDarren Tucker <dtucker@zip.com.au>2015-02-26 04:12:58 +1100
committerDarren Tucker <dtucker@zip.com.au>2015-02-26 04:12:58 +1100
commit678e473e2af2e4802f24dd913985864d9ead7fb3 (patch)
treec0caf85fdf328a2bfa615070eaa2ab97787a6b20 /openbsd-compat/bsd-misc.c
parent5d5ec165c5b614b03678afdad881f10e25832e46 (diff)
Remove dependency on xmalloc.
Remove ssh_get_progname's dependency on xmalloc, which should reduce link order problems. ok djm@
Diffstat (limited to 'openbsd-compat/bsd-misc.c')
-rw-r--r--openbsd-compat/bsd-misc.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/openbsd-compat/bsd-misc.c b/openbsd-compat/bsd-misc.c
index 65e80039..f7be415e 100644
--- a/openbsd-compat/bsd-misc.c
+++ b/openbsd-compat/bsd-misc.c
@@ -31,8 +31,6 @@
#include <time.h>
#include <unistd.h>
-#include "xmalloc.h"
-
#ifndef HAVE___PROGNAME
char *__progname;
#endif
@@ -43,13 +41,12 @@ char *__progname;
*/
char *ssh_get_progname(char *argv0)
{
+ char *p, *q;
#ifdef HAVE___PROGNAME
extern char *__progname;
- return xstrdup(__progname);
+ p = __progname;
#else
- char *p;
-
if (argv0 == NULL)
return ("unknown"); /* XXX */
p = strrchr(argv0, '/');
@@ -57,9 +54,12 @@ char *ssh_get_progname(char *argv0)
p = argv0;
else
p++;
-
- return (xstrdup(p));
#endif
+ if ((q = strdup(p)) == NULL) {
+ perror("strdup");
+ exit(1);
+ }
+ return q;
}
#ifndef HAVE_SETLOGIN