- remove priv_exit.
- sync errno handling code from orignal of syslogd.
This commit is contained in:
parent
ffefc2f17d
commit
43758179d9
3 changed files with 5 additions and 21 deletions
|
|
@ -93,7 +93,6 @@ server_terminate()
|
||||||
{
|
{
|
||||||
close_socket();
|
close_socket();
|
||||||
sj_closeall();
|
sj_closeall();
|
||||||
priv_exit();
|
|
||||||
|
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
@ -152,7 +151,6 @@ main(int argc, char **argv)
|
||||||
close_socket();
|
close_socket();
|
||||||
|
|
||||||
sj_closeall();
|
sj_closeall();
|
||||||
priv_exit();
|
|
||||||
|
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -33,8 +33,7 @@ enum priv_state {
|
||||||
};
|
};
|
||||||
|
|
||||||
enum cmd_types {
|
enum cmd_types {
|
||||||
PRIV_GETUGID,
|
PRIV_GETUGID
|
||||||
PRIV_EXIT
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static int auth_fd = -1;
|
static int auth_fd = -1;
|
||||||
|
|
@ -166,17 +165,12 @@ priv_init()
|
||||||
}
|
}
|
||||||
endpwent();
|
endpwent();
|
||||||
break;
|
break;
|
||||||
case PRIV_EXIT:
|
|
||||||
close(socks[0]);
|
|
||||||
_exit(1);
|
|
||||||
default:
|
default:
|
||||||
fprintf(stderr, "auth unknown command %d\n", cmd);
|
fprintf(stderr, "auth unknown command %d\n", cmd);
|
||||||
close(socks[0]);
|
close(socks[0]);
|
||||||
_exit(255);
|
_exit(255);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fprintf(stderr, "auth fatal error\n");
|
|
||||||
|
|
||||||
close(socks[0]);
|
close(socks[0]);
|
||||||
_exit(1);
|
_exit(1);
|
||||||
}
|
}
|
||||||
|
|
@ -255,11 +249,11 @@ must_write(int fd, void *buf, size_t n)
|
||||||
static void
|
static void
|
||||||
sig_pass_to_chld(int sig)
|
sig_pass_to_chld(int sig)
|
||||||
{
|
{
|
||||||
int oerrno = errno;
|
int save_errno = errno;
|
||||||
|
|
||||||
if (child_pid != -1)
|
if (child_pid != -1)
|
||||||
kill(child_pid, sig);
|
kill(child_pid, sig);
|
||||||
errno = oerrno;
|
errno = save_errno;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* When child dies, move into the shutdown state */
|
/* When child dies, move into the shutdown state */
|
||||||
|
|
@ -267,6 +261,7 @@ sig_pass_to_chld(int sig)
|
||||||
static void
|
static void
|
||||||
sig_got_chld(int sig)
|
sig_got_chld(int sig)
|
||||||
{
|
{
|
||||||
|
int save_errno = errno;
|
||||||
pid_t pid;
|
pid_t pid;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
|
|
@ -274,6 +269,7 @@ sig_got_chld(int sig)
|
||||||
if (pid == child_pid && cur_state < STATE_QUIT)
|
if (pid == child_pid && cur_state < STATE_QUIT)
|
||||||
cur_state = STATE_QUIT;
|
cur_state = STATE_QUIT;
|
||||||
} while (pid > 0 || (pid == -1 && errno == EINTR));
|
} while (pid > 0 || (pid == -1 && errno == EINTR));
|
||||||
|
errno = save_errno;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
|
@ -309,13 +305,4 @@ priv_getugid(char *username, sj3_ugid *ugid)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
priv_exit()
|
|
||||||
{
|
|
||||||
int cmd = PRIV_EXIT;
|
|
||||||
|
|
||||||
must_write(auth_fd, &cmd, sizeof(int));
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,6 @@ typedef struct {
|
||||||
/* auth.c */
|
/* auth.c */
|
||||||
|
|
||||||
int priv_init();
|
int priv_init();
|
||||||
void priv_exit();
|
|
||||||
|
|
||||||
int priv_getugid(char *, sj3_ugid *);
|
int priv_getugid(char *, sj3_ugid *);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue