Silence compiler warnings on Solaris with gcc 3.4.3
This commit is contained in:
@@ -98,7 +98,7 @@ rewind_perms(void)
|
|||||||
int
|
int
|
||||||
set_perms(int perm)
|
set_perms(int perm)
|
||||||
{
|
{
|
||||||
struct perm_state *state, *ostate;
|
struct perm_state *state, *ostate = NULL;
|
||||||
const char *errstr;
|
const char *errstr;
|
||||||
int noexit;
|
int noexit;
|
||||||
|
|
||||||
@@ -304,19 +304,22 @@ restore_perms(void)
|
|||||||
/* XXX - more cases here where euid != ruid */
|
/* XXX - more cases here where euid != ruid */
|
||||||
if (OID(euid) == ROOT_UID && state->euid != ROOT_UID) {
|
if (OID(euid) == ROOT_UID && state->euid != ROOT_UID) {
|
||||||
if (setresuid(-1, ROOT_UID, -1)) {
|
if (setresuid(-1, ROOT_UID, -1)) {
|
||||||
warning("setresuid() [%d, %d, %d] -> [%d, %d, %d]", state->ruid,
|
warning("setresuid() [%d, %d, %d] -> [%d, %d, %d]",
|
||||||
state->euid, state->suid, -1, ROOT_UID, -1);
|
(int)state->ruid, (int)state->euid, (int)state->suid,
|
||||||
|
-1, ROOT_UID, -1);
|
||||||
goto bad;
|
goto bad;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (setresuid(OID(ruid), OID(euid), OID(suid))) {
|
if (setresuid(OID(ruid), OID(euid), OID(suid))) {
|
||||||
warning("setresuid() [%d, %d, %d] -> [%d, %d, %d]", state->ruid,
|
warning("setresuid() [%d, %d, %d] -> [%d, %d, %d]",
|
||||||
state->euid, state->suid, OID(ruid), OID(euid), OID(suid));
|
(int)state->ruid, (int)state->euid, (int)state->suid,
|
||||||
|
(int)OID(ruid), (int)OID(euid), (int)OID(suid));
|
||||||
goto bad;
|
goto bad;
|
||||||
}
|
}
|
||||||
if (setresgid(OID(rgid), OID(egid), OID(sgid))) {
|
if (setresgid(OID(rgid), OID(egid), OID(sgid))) {
|
||||||
warning("setresgid() [%d, %d, %d] -> [%d, %d, %d]", state->rgid,
|
warning("setresgid() [%d, %d, %d] -> [%d, %d, %d]",
|
||||||
state->egid, state->sgid, OID(rgid), OID(egid), OID(sgid));
|
(int)state->rgid, (int)state->egid, (int)state->sgid,
|
||||||
|
(int)OID(rgid), (int)OID(egid), (int)OID(sgid));
|
||||||
goto bad;
|
goto bad;
|
||||||
}
|
}
|
||||||
if (state->grlist != ostate->grlist) {
|
if (state->grlist != ostate->grlist) {
|
||||||
@@ -344,7 +347,7 @@ bad:
|
|||||||
int
|
int
|
||||||
set_perms(int perm)
|
set_perms(int perm)
|
||||||
{
|
{
|
||||||
struct perm_state *state, *ostate;
|
struct perm_state *state, *ostate = NULL;
|
||||||
const char *errstr;
|
const char *errstr;
|
||||||
int noexit;
|
int noexit;
|
||||||
|
|
||||||
@@ -542,13 +545,13 @@ restore_perms(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (setreuid(OID(ruid), OID(euid))) {
|
if (setreuid(OID(ruid), OID(euid))) {
|
||||||
warning("setreuid() [%d, %d] -> [%d, %d]", state->ruid,
|
warning("setreuid() [%d, %d] -> [%d, %d]", (int)state->ruid,
|
||||||
state->euid, OID(ruid), OID(euid));
|
(int)state->euid, (int)OID(ruid), (int)OID(euid));
|
||||||
goto bad;
|
goto bad;
|
||||||
}
|
}
|
||||||
if (setregid(OID(rgid), OID(egid))) {
|
if (setregid(OID(rgid), OID(egid))) {
|
||||||
warning("setregid() [%d, %d] -> [%d, %d]", state->rgid,
|
warning("setregid() [%d, %d] -> [%d, %d]", (int)state->rgid,
|
||||||
state->egid, OID(rgid), OID(egid));
|
(int)state->egid, (int)OID(rgid), (int)OID(egid));
|
||||||
goto bad;
|
goto bad;
|
||||||
}
|
}
|
||||||
if (state->grlist != ostate->grlist) {
|
if (state->grlist != ostate->grlist) {
|
||||||
@@ -576,7 +579,7 @@ bad:
|
|||||||
int
|
int
|
||||||
set_perms(int perm)
|
set_perms(int perm)
|
||||||
{
|
{
|
||||||
struct perm_state *state, *ostate;
|
struct perm_state *state, *ostate = NULL;
|
||||||
const char *errstr;
|
const char *errstr;
|
||||||
int noexit;
|
int noexit;
|
||||||
|
|
||||||
@@ -780,7 +783,7 @@ restore_perms(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (setegid(OID(egid))) {
|
if (setegid(OID(egid))) {
|
||||||
warning("setegid(%d)", OID(egid));
|
warning("setegid(%d)", (int)OID(egid));
|
||||||
goto bad;
|
goto bad;
|
||||||
}
|
}
|
||||||
if (state->grlist != ostate->grlist) {
|
if (state->grlist != ostate->grlist) {
|
||||||
@@ -790,7 +793,7 @@ restore_perms(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (seteuid(OID(euid))) {
|
if (seteuid(OID(euid))) {
|
||||||
warning("seteuid(%d)", OID(euid));
|
warning("seteuid(%d)", (int)OID(euid));
|
||||||
goto bad;
|
goto bad;
|
||||||
}
|
}
|
||||||
grlist_delref(state->grlist);
|
grlist_delref(state->grlist);
|
||||||
@@ -810,7 +813,7 @@ bad:
|
|||||||
int
|
int
|
||||||
set_perms(int perm)
|
set_perms(int perm)
|
||||||
{
|
{
|
||||||
struct perm_state *state, *ostate;
|
struct perm_state *state, *ostate = NULL;
|
||||||
const char *errstr;
|
const char *errstr;
|
||||||
int noexit;
|
int noexit;
|
||||||
|
|
||||||
@@ -906,7 +909,7 @@ restore_perms(void)
|
|||||||
perm_stack_depth--;
|
perm_stack_depth--;
|
||||||
|
|
||||||
if (OID(rgid) != -1 && setgid(ostate->rgid)) {
|
if (OID(rgid) != -1 && setgid(ostate->rgid)) {
|
||||||
warning("setgid(%d)", ostate->rgid);
|
warning("setgid(%d)", (int)ostate->rgid);
|
||||||
goto bad;
|
goto bad;
|
||||||
}
|
}
|
||||||
if (state->grlist != ostate->grlist) {
|
if (state->grlist != ostate->grlist) {
|
||||||
@@ -917,7 +920,7 @@ restore_perms(void)
|
|||||||
}
|
}
|
||||||
grlist_delref(state->grlist);
|
grlist_delref(state->grlist);
|
||||||
if (OID(ruid) != -1 && setuid(ostate->ruid)) {
|
if (OID(ruid) != -1 && setuid(ostate->ruid)) {
|
||||||
warning("setuid(%d)", ostate->ruid);
|
warning("setuid(%d)", (int)ostate->ruid);
|
||||||
goto bad;
|
goto bad;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
@@ -499,16 +499,16 @@ install_sudoers(struct sudoersfile *sp, int oldperms)
|
|||||||
#endif
|
#endif
|
||||||
error(1, _("unable to stat %s"), sp->path);
|
error(1, _("unable to stat %s"), sp->path);
|
||||||
if (chown(sp->tpath, sb.st_uid, sb.st_gid) != 0) {
|
if (chown(sp->tpath, sb.st_uid, sb.st_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, sb.st_uid, sb.st_gid);
|
sp->tpath, (unsigned int)sb.st_uid, (unsigned int)sb.st_gid);
|
||||||
}
|
}
|
||||||
if (chmod(sp->tpath, sb.st_mode & 0777) != 0) {
|
if (chmod(sp->tpath, sb.st_mode & 0777) != 0) {
|
||||||
warning(_("unable to change mode of %s to 0%o"), sp->tpath,
|
warning(_("unable to change mode of %s to 0%o"), sp->tpath,
|
||||||
(sb.st_mode & 0777));
|
(unsigned int)(sb.st_mode & 0777));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (chown(sp->tpath, SUDOERS_UID, SUDOERS_GID) != 0) {
|
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);
|
sp->tpath, SUDOERS_UID, SUDOERS_GID);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@@ -734,7 +734,7 @@ check_syntax(char *sudoers_path, int quiet, int strict)
|
|||||||
error = TRUE;
|
error = TRUE;
|
||||||
if (!quiet) {
|
if (!quiet) {
|
||||||
fprintf(stderr,
|
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);
|
sudoers_path, SUDOERS_UID, SUDOERS_GID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -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);
|
int fd = open(_PATH_TTY, O_RDWR|O_NOCTTY, 0);
|
||||||
if (fd != -1)
|
if (fd != -1)
|
||||||
saved_pgrp = tcgetpgrp(fd);
|
saved_pgrp = tcgetpgrp(fd);
|
||||||
if (kill(getpid(), WSTOPSIG(status)) != 0)
|
if (kill(getpid(), WSTOPSIG(status)) != 0) {
|
||||||
warning("kill(%d, %d)", getpid(), WSTOPSIG(status));
|
warning("kill(%d, %d)", (int)getpid(),
|
||||||
|
WSTOPSIG(status));
|
||||||
|
}
|
||||||
if (fd != -1) {
|
if (fd != -1) {
|
||||||
if (saved_pgrp != (pid_t)-1)
|
if (saved_pgrp != (pid_t)-1)
|
||||||
(void)tcsetpgrp(fd, saved_pgrp);
|
(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)
|
if (signo == SIGALRM)
|
||||||
terminate_child(child, FALSE);
|
terminate_child(child, FALSE);
|
||||||
else if (kill(child, signo) != 0)
|
else if (kill(child, signo) != 0)
|
||||||
warning("kill(%d, %d)", child, signo);
|
warning("kill(%d, %d)", (int)child, signo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -323,7 +323,7 @@ suspend_parent(int signo)
|
|||||||
sigaction(signo, &sa, &osa);
|
sigaction(signo, &sa, &osa);
|
||||||
sudo_debug(8, "kill parent %d", signo);
|
sudo_debug(8, "kill parent %d", signo);
|
||||||
if (killpg(ppgrp, signo) != 0)
|
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/background status on resume. */
|
||||||
check_foreground();
|
check_foreground();
|
||||||
|
10
src/sudo.c
10
src/sudo.c
@@ -956,12 +956,14 @@ exec_setup(struct command_details *details, const char *ptyname, int ptyfd)
|
|||||||
*/
|
*/
|
||||||
#ifdef HAVE_SETEUID
|
#ifdef HAVE_SETEUID
|
||||||
if (ISSET(details->flags, CD_SET_EGID) && setegid(details->egid)) {
|
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;
|
goto done;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (ISSET(details->flags, CD_SET_GID) && setgid(details->gid)) {
|
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;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1000,8 +1002,8 @@ exec_setup(struct command_details *details, const char *ptyname, int ptyfd)
|
|||||||
}
|
}
|
||||||
#elif HAVE_SETREUID
|
#elif HAVE_SETREUID
|
||||||
if (setreuid(details->uid, details->euid) != 0) {
|
if (setreuid(details->uid, details->euid) != 0) {
|
||||||
warning(_("unable to change to runas uid (%u, %u)"), details->uid,
|
warning(_("unable to change to runas uid (%u, %u)"),
|
||||||
details->euid);
|
(unsigned int)details->uid, (unsigned int)details->euid);
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
Reference in New Issue
Block a user