Silence compiler warnings on Solaris with gcc 3.4.3

This commit is contained in:
Todd C. Miller
2011-08-23 16:42:18 -04:00
parent 335901388e
commit d81c14005f
5 changed files with 38 additions and 31 deletions

View File

@@ -98,7 +98,7 @@ rewind_perms(void)
int
set_perms(int perm)
{
struct perm_state *state, *ostate;
struct perm_state *state, *ostate = NULL;
const char *errstr;
int noexit;
@@ -304,19 +304,22 @@ restore_perms(void)
/* XXX - more cases here where euid != ruid */
if (OID(euid) == ROOT_UID && state->euid != ROOT_UID) {
if (setresuid(-1, ROOT_UID, -1)) {
warning("setresuid() [%d, %d, %d] -> [%d, %d, %d]", state->ruid,
state->euid, state->suid, -1, ROOT_UID, -1);
warning("setresuid() [%d, %d, %d] -> [%d, %d, %d]",
(int)state->ruid, (int)state->euid, (int)state->suid,
-1, ROOT_UID, -1);
goto bad;
}
}
if (setresuid(OID(ruid), OID(euid), OID(suid))) {
warning("setresuid() [%d, %d, %d] -> [%d, %d, %d]", state->ruid,
state->euid, state->suid, OID(ruid), OID(euid), OID(suid));
warning("setresuid() [%d, %d, %d] -> [%d, %d, %d]",
(int)state->ruid, (int)state->euid, (int)state->suid,
(int)OID(ruid), (int)OID(euid), (int)OID(suid));
goto bad;
}
if (setresgid(OID(rgid), OID(egid), OID(sgid))) {
warning("setresgid() [%d, %d, %d] -> [%d, %d, %d]", state->rgid,
state->egid, state->sgid, OID(rgid), OID(egid), OID(sgid));
warning("setresgid() [%d, %d, %d] -> [%d, %d, %d]",
(int)state->rgid, (int)state->egid, (int)state->sgid,
(int)OID(rgid), (int)OID(egid), (int)OID(sgid));
goto bad;
}
if (state->grlist != ostate->grlist) {
@@ -344,7 +347,7 @@ bad:
int
set_perms(int perm)
{
struct perm_state *state, *ostate;
struct perm_state *state, *ostate = NULL;
const char *errstr;
int noexit;
@@ -542,13 +545,13 @@ restore_perms(void)
}
}
if (setreuid(OID(ruid), OID(euid))) {
warning("setreuid() [%d, %d] -> [%d, %d]", state->ruid,
state->euid, OID(ruid), OID(euid));
warning("setreuid() [%d, %d] -> [%d, %d]", (int)state->ruid,
(int)state->euid, (int)OID(ruid), (int)OID(euid));
goto bad;
}
if (setregid(OID(rgid), OID(egid))) {
warning("setregid() [%d, %d] -> [%d, %d]", state->rgid,
state->egid, OID(rgid), OID(egid));
warning("setregid() [%d, %d] -> [%d, %d]", (int)state->rgid,
(int)state->egid, (int)OID(rgid), (int)OID(egid));
goto bad;
}
if (state->grlist != ostate->grlist) {
@@ -576,7 +579,7 @@ bad:
int
set_perms(int perm)
{
struct perm_state *state, *ostate;
struct perm_state *state, *ostate = NULL;
const char *errstr;
int noexit;
@@ -780,7 +783,7 @@ restore_perms(void)
}
if (setegid(OID(egid))) {
warning("setegid(%d)", OID(egid));
warning("setegid(%d)", (int)OID(egid));
goto bad;
}
if (state->grlist != ostate->grlist) {
@@ -790,7 +793,7 @@ restore_perms(void)
}
}
if (seteuid(OID(euid))) {
warning("seteuid(%d)", OID(euid));
warning("seteuid(%d)", (int)OID(euid));
goto bad;
}
grlist_delref(state->grlist);
@@ -810,7 +813,7 @@ bad:
int
set_perms(int perm)
{
struct perm_state *state, *ostate;
struct perm_state *state, *ostate = NULL;
const char *errstr;
int noexit;
@@ -906,7 +909,7 @@ restore_perms(void)
perm_stack_depth--;
if (OID(rgid) != -1 && setgid(ostate->rgid)) {
warning("setgid(%d)", ostate->rgid);
warning("setgid(%d)", (int)ostate->rgid);
goto bad;
}
if (state->grlist != ostate->grlist) {
@@ -917,7 +920,7 @@ restore_perms(void)
}
grlist_delref(state->grlist);
if (OID(ruid) != -1 && setuid(ostate->ruid)) {
warning("setuid(%d)", ostate->ruid);
warning("setuid(%d)", (int)ostate->ruid);
goto bad;
}
return;

View File

@@ -499,16 +499,16 @@ install_sudoers(struct sudoersfile *sp, int oldperms)
#endif
error(1, _("unable to stat %s"), sp->path);
if (chown(sp->tpath, sb.st_uid, sb.st_gid) != 0) {
warning(_("unable to set (uid, gid) of %s to (%d, %d)"),
sp->tpath, sb.st_uid, sb.st_gid);
warning(_("unable to set (uid, gid) of %s to (%u, %u)"),
sp->tpath, (unsigned int)sb.st_uid, (unsigned int)sb.st_gid);
}
if (chmod(sp->tpath, sb.st_mode & 0777) != 0) {
warning(_("unable to change mode of %s to 0%o"), sp->tpath,
(sb.st_mode & 0777));
(unsigned int)(sb.st_mode & 0777));
}
} else {
if (chown(sp->tpath, SUDOERS_UID, SUDOERS_GID) != 0) {
warning(_("unable to set (uid, gid) of %s to (%d, %d)"),
warning(_("unable to set (uid, gid) of %s to (%u, %u)"),
sp->tpath, SUDOERS_UID, SUDOERS_GID);
return FALSE;
}
@@ -734,7 +734,7 @@ check_syntax(char *sudoers_path, int quiet, int strict)
error = TRUE;
if (!quiet) {
fprintf(stderr,
_("%s: wrong owner (uid, gid) should be (%d, %d)\n"),
_("%s: wrong owner (uid, gid) should be (%u, %u)\n"),
sudoers_path, SUDOERS_UID, SUDOERS_GID);
}
}

View File

@@ -451,8 +451,10 @@ handle_signals(int fd, pid_t child, int log_io, struct command_status *cstat)
int fd = open(_PATH_TTY, O_RDWR|O_NOCTTY, 0);
if (fd != -1)
saved_pgrp = tcgetpgrp(fd);
if (kill(getpid(), WSTOPSIG(status)) != 0)
warning("kill(%d, %d)", getpid(), WSTOPSIG(status));
if (kill(getpid(), WSTOPSIG(status)) != 0) {
warning("kill(%d, %d)", (int)getpid(),
WSTOPSIG(status));
}
if (fd != -1) {
if (saved_pgrp != (pid_t)-1)
(void)tcsetpgrp(fd, saved_pgrp);
@@ -476,7 +478,7 @@ handle_signals(int fd, pid_t child, int log_io, struct command_status *cstat)
if (signo == SIGALRM)
terminate_child(child, FALSE);
else if (kill(child, signo) != 0)
warning("kill(%d, %d)", child, signo);
warning("kill(%d, %d)", (int)child, signo);
}
}
}

View File

@@ -323,7 +323,7 @@ suspend_parent(int signo)
sigaction(signo, &sa, &osa);
sudo_debug(8, "kill parent %d", signo);
if (killpg(ppgrp, signo) != 0)
warning("killpg(%d, %d)", ppgrp, signo);
warning("killpg(%d, %d)", (int)ppgrp, signo);
/* Check foreground/background status on resume. */
check_foreground();

View File

@@ -956,12 +956,14 @@ exec_setup(struct command_details *details, const char *ptyname, int ptyfd)
*/
#ifdef HAVE_SETEUID
if (ISSET(details->flags, CD_SET_EGID) && setegid(details->egid)) {
warning(_("unable to set effective gid to runas gid %u"), details->egid);
warning(_("unable to set effective gid to runas gid %u"),
(unsigned int)details->egid);
goto done;
}
#endif
if (ISSET(details->flags, CD_SET_GID) && setgid(details->gid)) {
warning(_("unable to set gid to runas gid %u"), details->gid);
warning(_("unable to set gid to runas gid %u"),
(unsigned int)details->gid);
goto done;
}
@@ -1000,8 +1002,8 @@ exec_setup(struct command_details *details, const char *ptyname, int ptyfd)
}
#elif HAVE_SETREUID
if (setreuid(details->uid, details->euid) != 0) {
warning(_("unable to change to runas uid (%u, %u)"), details->uid,
details->euid);
warning(_("unable to change to runas uid (%u, %u)"),
(unsigned int)details->uid, (unsigned int)details->euid);
goto done;
}
#else