crond: make it NOMMU-capable

function                                             old     new   delta
safe_setenv4                                           -      62     +62
ForkJob                                              472     511     +39
change_identity                                       21      57     +36
ParseField                                           564     571      +7
SynchronizeDir                                       178     176      -2
LogLevel                                               4       -      -4
LogFile                                                4       -      -4
FileBase                                               4       -      -4
DebugOpt                                               4       -      -4
CDir                                                   4       -      -4
DeleteFile                                           141     132      -9
packed_usage                                       24248   24228     -20
crondlog                                             157     113     -44
change_identity_e2str                                 54       -     -54
SynchronizeFile                                      729     671     -58
crond_main                                          1555    1404    -151
------------------------------------------------------------------------------
(add/remove: 1/6 grow/shrink: 3/6 up/down: 144/-358)         Total: -214 bytes
This commit is contained in:
Denis Vlasenko
2008-03-12 22:10:25 +00:00
parent 35e9c5d83a
commit 4e6c8120a5
6 changed files with 403 additions and 429 deletions

View File

@@ -30,22 +30,12 @@
#include "libbb.h"
/* Become the user and group(s) specified by PW. */
const char *change_identity_e2str(const struct passwd *pw)
void change_identity(const struct passwd *pw)
{
if (initgroups(pw->pw_name, pw->pw_gid) == -1)
return "cannot set groups";
bb_perror_msg_and_die("can't set groups");
endgrent(); /* ?? */
xsetgid(pw->pw_gid);
xsetuid(pw->pw_uid);
return NULL;
}
void change_identity(const struct passwd *pw)
{
const char *err_msg = change_identity_e2str(pw);
if (err_msg)
bb_simple_perror_msg_and_die(err_msg);
}