added explict casts for strdup since many includes don't prototype
it. gag me.
This commit is contained in:
@@ -132,7 +132,7 @@ char * find_path(file)
|
|||||||
if ((path = getenv("PATH")) == NULL)
|
if ((path = getenv("PATH")) == NULL)
|
||||||
return(NULL);
|
return(NULL);
|
||||||
|
|
||||||
if ((path = strdup(path)) == NULL) {
|
if ((path = (char *) strdup(path)) == NULL) {
|
||||||
(void) fprintf(stderr, "%s: out of memory!\n", Argv[0]);
|
(void) fprintf(stderr, "%s: out of memory!\n", Argv[0]);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
@@ -218,14 +218,14 @@ struct passwd *sudo_getpwuid(uid)
|
|||||||
*/
|
*/
|
||||||
(void) memcpy(local_pw_ent, pw_ent, sizeof(struct passwd));
|
(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) {
|
if (local_pw_ent->pw_name == NULL) {
|
||||||
perror("malloc");
|
perror("malloc");
|
||||||
(void) fprintf(stderr, "%s: cannot allocate memory!\n", Argv[0]);
|
(void) fprintf(stderr, "%s: cannot allocate memory!\n", Argv[0]);
|
||||||
exit(1);
|
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) {
|
if (local_pw_ent->pw_dir == NULL) {
|
||||||
perror("malloc");
|
perror("malloc");
|
||||||
(void) fprintf(stderr, "%s: cannot allocate memory!\n", Argv[0]);
|
(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 */
|
/* 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) {
|
if (local_pw_ent->pw_shell == NULL) {
|
||||||
perror("malloc");
|
perror("malloc");
|
||||||
(void) fprintf(stderr, "%s: cannot allocate memory!\n", Argv[0]);
|
(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 */
|
/* 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) {
|
if (local_pw_ent->pw_passwd == NULL) {
|
||||||
perror("malloc");
|
perror("malloc");
|
||||||
(void) fprintf(stderr, "%s: cannot allocate memory!\n", Argv[0]);
|
(void) fprintf(stderr, "%s: cannot allocate memory!\n", Argv[0]);
|
||||||
|
2
sudo.c
2
sudo.c
@@ -400,7 +400,7 @@ static void load_globals(sudo_mode)
|
|||||||
if ((tty = (char *) ttyname(0)) || (tty = (char *) ttyname(1))) {
|
if ((tty = (char *) ttyname(0)) || (tty = (char *) ttyname(1))) {
|
||||||
if (strncmp(tty, _PATH_DEV, sizeof(_PATH_DEV) - 1) == 0)
|
if (strncmp(tty, _PATH_DEV, sizeof(_PATH_DEV) - 1) == 0)
|
||||||
tty += sizeof(_PATH_DEV) - 1;
|
tty += sizeof(_PATH_DEV) - 1;
|
||||||
if ((tty = strdup(tty)) == NULL) {
|
if ((tty = (char *) strdup(tty)) == NULL) {
|
||||||
perror("malloc");
|
perror("malloc");
|
||||||
(void) fprintf(stderr, "%s: cannot allocate memory!\n", Argv[0]);
|
(void) fprintf(stderr, "%s: cannot allocate memory!\n", Argv[0]);
|
||||||
exit(1);
|
exit(1);
|
||||||
|
Reference in New Issue
Block a user