From d7716e975e2d9afed61b7fba9467f2a823b6e1a6 Mon Sep 17 00:00:00 2001 From: "Todd C. Miller" Date: Sat, 25 Nov 1995 18:53:22 +0000 Subject: [PATCH] added explict casts for strdup since many includes don't prototype it. gag me. --- find_path.c | 2 +- getspwuid.c | 8 ++++---- sudo.c | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/find_path.c b/find_path.c index 0d6849bc7..f7a1db07f 100644 --- a/find_path.c +++ b/find_path.c @@ -132,7 +132,7 @@ char * find_path(file) if ((path = getenv("PATH")) == NULL) return(NULL); - if ((path = strdup(path)) == NULL) { + if ((path = (char *) strdup(path)) == NULL) { (void) fprintf(stderr, "%s: out of memory!\n", Argv[0]); exit(1); } diff --git a/getspwuid.c b/getspwuid.c index 7d36c26dc..64a830537 100644 --- a/getspwuid.c +++ b/getspwuid.c @@ -218,14 +218,14 @@ struct passwd *sudo_getpwuid(uid) */ (void) memcpy(local_pw_ent, pw_ent, sizeof(struct passwd)); - local_pw_ent->pw_name = strdup(pw_ent->pw_name); + local_pw_ent->pw_name = (char *) strdup(pw_ent->pw_name); if (local_pw_ent->pw_name == NULL) { perror("malloc"); (void) fprintf(stderr, "%s: cannot allocate memory!\n", Argv[0]); exit(1); } - local_pw_ent->pw_dir = strdup(pw_ent->pw_dir); + local_pw_ent->pw_dir = (char *) strdup(pw_ent->pw_dir); if (local_pw_ent->pw_dir == NULL) { perror("malloc"); (void) fprintf(stderr, "%s: cannot allocate memory!\n", Argv[0]); @@ -233,7 +233,7 @@ struct passwd *sudo_getpwuid(uid) } /* pw_shell is a special case since we overide with $SHELL */ - local_pw_ent->pw_shell = strdup(sudo_getshell(pw_ent)); + local_pw_ent->pw_shell = (char *) strdup(sudo_getshell(pw_ent)); if (local_pw_ent->pw_shell == NULL) { perror("malloc"); (void) fprintf(stderr, "%s: cannot allocate memory!\n", Argv[0]); @@ -241,7 +241,7 @@ struct passwd *sudo_getpwuid(uid) } /* pw_passwd gets a shadow password if applicable */ - local_pw_ent->pw_passwd = strdup(sudo_getspwd(pw_ent)); + local_pw_ent->pw_passwd = (char *) strdup(sudo_getspwd(pw_ent)); if (local_pw_ent->pw_passwd == NULL) { perror("malloc"); (void) fprintf(stderr, "%s: cannot allocate memory!\n", Argv[0]); diff --git a/sudo.c b/sudo.c index 2afa9c45f..8e9f55392 100644 --- a/sudo.c +++ b/sudo.c @@ -400,7 +400,7 @@ static void load_globals(sudo_mode) if ((tty = (char *) ttyname(0)) || (tty = (char *) ttyname(1))) { if (strncmp(tty, _PATH_DEV, sizeof(_PATH_DEV) - 1) == 0) tty += sizeof(_PATH_DEV) - 1; - if ((tty = strdup(tty)) == NULL) { + if ((tty = (char *) strdup(tty)) == NULL) { perror("malloc"); (void) fprintf(stderr, "%s: cannot allocate memory!\n", Argv[0]); exit(1);