diff options
author | Steffen Nurpmeso <steffen@sdaoden.eu> | 2020-08-11 16:28:37 +0200 |
---|---|---|
committer | Steffen Nurpmeso <steffen@sdaoden.eu> | 2020-08-11 16:37:31 +0200 |
commit | c4902c40c32833a2160882e0805f0ad804da91fe (patch) | |
tree | ed71f1a5d3d8a42bdc44abc0b15d8235df650982 | |
parent | 31401da642c63a50085b41061228e28072c9b15d (diff) | |
download | start-stop-daemon-c4902c40c32833a2160882e0805f0ad804da91fe.tar.gz start-stop-daemon-c4902c40c32833a2160882e0805f0ad804da91fe.tar.xz |
-rw-r--r-- | crux-patch.diff | 52 | ||||
-rw-r--r-- | start-stop-daemon.c | 11 |
2 files changed, 38 insertions, 25 deletions
diff --git a/crux-patch.diff b/crux-patch.diff index 7d401db..5e580ab 100644 --- a/crux-patch.diff +++ b/crux-patch.diff @@ -1,5 +1,5 @@ diff --git a/start-stop-daemon.8 b/start-stop-daemon.8 -index 2a083f3..5daeab2 100644 +index 2a083f3..bbeb0f6 100644 --- a/start-stop-daemon.8 +++ b/start-stop-daemon.8 @@ -20,7 +20,7 @@ @@ -7,7 +7,7 @@ index 2a083f3..5daeab2 100644 .\" along with this program. If not, see <https://www.gnu.org/licenses/>. . -.TH start\-stop\-daemon 8 "%RELEASE_DATE%" "%VERSION%" "dpkg suite" -+.TH start\-stop\-daemon 8 "2019-03-10" "CRUX 3.5" "dpkg suite" ++.TH start\-stop\-daemon 8 "2020-08-11" "CRUX 3.6" "dpkg suite" .nh .SH NAME start\-stop\-daemon \- start and stop system daemon programs @@ -46,10 +46,10 @@ index 2a083f3..5daeab2 100644 Do not close any file descriptor when forcing the daemon into the background (since version 1.16.5). diff --git a/start-stop-daemon.c b/start-stop-daemon.c -index 88c9726..bcdce53 100644 +index 3947cc0..1e0e163 100644 --- a/start-stop-daemon.c +++ b/start-stop-daemon.c -@@ -20,10 +20,37 @@ +@@ -20,10 +20,36 @@ * Changes by Ian Jackson: added --retry (and associated rearrangements). */ @@ -59,14 +59,13 @@ index 88c9726..bcdce53 100644 #include <dpkg/macros.h> +#else -+# define VERSION "20190310" ++# define VERSION "20200811" +# define CRUX "CRUX-Linux" + +# define WANT_SYSTEMD_NOTIFY 0 /* 1=yes */ + +# define HAVE_SYS_PARAM_H +# define HAVE_SYS_SYSCALL_H -+# define HAVE_SYS_SYSCTL_H +# define HAVE_SYS_USER_H +# define HAVE_STDDEF_H +# define HAVE_ERROR_H @@ -87,7 +86,7 @@ index 88c9726..bcdce53 100644 #if defined(__linux__) # define OS_Linux -@@ -160,6 +187,10 @@ +@@ -160,6 +186,10 @@ #define HAVE_IOPRIO_SET #endif @@ -98,7 +97,7 @@ index 88c9726..bcdce53 100644 #define IOPRIO_CLASS_SHIFT 13 #define IOPRIO_PRIO_VALUE(class, prio) (((class) << IOPRIO_CLASS_SHIFT) | (prio)) #define IO_SCHED_PRIO_MIN 0 -@@ -212,10 +243,12 @@ static int quietmode = 0; +@@ -212,10 +242,12 @@ static int quietmode = 0; static int exitnodo = 1; static bool background = false; static bool close_io = true; @@ -111,7 +110,7 @@ index 88c9726..bcdce53 100644 static bool mpidfile = false; static bool rpidfile = false; static int signal_nr = SIGTERM; -@@ -405,8 +438,7 @@ xstrndup(const char *str, size_t n) +@@ -405,8 +437,7 @@ xstrndup(const char *str, size_t n) static void timespec_gettime(struct timespec *ts) { @@ -121,7 +120,7 @@ index 88c9726..bcdce53 100644 if (clock_gettime(CLOCK_MONOTONIC, ts) < 0) fatale("clock_gettime failed"); #else -@@ -548,6 +580,7 @@ wait_for_child(pid_t pid) +@@ -548,6 +579,7 @@ wait_for_child(pid_t pid) } } @@ -129,7 +128,7 @@ index 88c9726..bcdce53 100644 static void cleanup_socket_dir(void) { -@@ -737,6 +770,7 @@ wait_for_notify(int fd) +@@ -737,6 +769,7 @@ wait_for_notify(int fd) } } } @@ -137,7 +136,7 @@ index 88c9726..bcdce53 100644 static void write_pidfile(const char *filename, pid_t pid) -@@ -769,7 +803,9 @@ remove_pidfile(const char *filename) +@@ -769,7 +802,9 @@ remove_pidfile(const char *filename) static void daemonize(void) { @@ -147,7 +146,7 @@ index 88c9726..bcdce53 100644 pid_t pid; sigset_t mask; sigset_t oldmask; -@@ -783,8 +819,10 @@ daemonize(void) +@@ -783,8 +818,10 @@ daemonize(void) if (sigprocmask(SIG_BLOCK, &mask, &oldmask) == -1) fatale("cannot block SIGCHLD"); @@ -158,7 +157,7 @@ index 88c9726..bcdce53 100644 pid = fork(); if (pid < 0) -@@ -795,6 +833,7 @@ daemonize(void) +@@ -795,6 +832,7 @@ daemonize(void) * not suffer from race conditions on return. */ wait_for_child(pid); @@ -166,7 +165,7 @@ index 88c9726..bcdce53 100644 if (notify_await) { /* Wait for a readiness notification from the second * child, so that we can safely exit when the service -@@ -803,6 +842,7 @@ daemonize(void) +@@ -803,13 +841,16 @@ daemonize(void) close(notify_fd); cleanup_socket_dir(); } @@ -174,7 +173,16 @@ index 88c9726..bcdce53 100644 _exit(0); } -@@ -901,8 +941,10 @@ usage(void) + + /* Close the notification socket, even though it is close-on-exec. */ ++#if WANT_SYSTEMD_NOTIFY + if (notify_await) + close(notify_fd); ++#endif + + /* Create a new session. */ + if (setsid() < 0) +@@ -905,8 +946,10 @@ usage(void) " scheduler (default prio is 4)\n" " -k, --umask <mask> change the umask to <mask> before starting\n" " -b, --background force the process to detach\n" @@ -185,7 +193,7 @@ index 88c9726..bcdce53 100644 " -C, --no-close do not close any file descriptor\n" " -m, --make-pidfile create the pidfile before starting\n" " --remove-pidfile delete the pidfile after stopping\n" -@@ -947,9 +989,9 @@ usage(void) +@@ -951,9 +994,9 @@ usage(void) static void do_version(void) { @@ -198,7 +206,7 @@ index 88c9726..bcdce53 100644 } static void DPKG_ATTR_NORET -@@ -1274,8 +1316,10 @@ parse_options(int argc, char * const *argv) +@@ -1278,8 +1321,10 @@ parse_options(int argc, char * const *argv) { "iosched", 1, NULL, 'I'}, { "umask", 1, NULL, 'k'}, { "background", 0, NULL, 'b'}, @@ -209,7 +217,7 @@ index 88c9726..bcdce53 100644 { "no-close", 0, NULL, 'C'}, { "make-pidfile", 0, NULL, 'm'}, { "remove-pidfile", 0, NULL, OPT_RM_PIDFILE}, -@@ -1290,7 +1334,9 @@ parse_options(int argc, char * const *argv) +@@ -1294,7 +1339,9 @@ parse_options(int argc, char * const *argv) const char *schedule_str = NULL; const char *proc_schedule_str = NULL; const char *io_schedule_str = NULL; @@ -219,7 +227,7 @@ index 88c9726..bcdce53 100644 size_t changeuser_len; int c; -@@ -1390,12 +1436,14 @@ parse_options(int argc, char * const *argv) +@@ -1395,12 +1442,14 @@ parse_options(int argc, char * const *argv) case 'b': /* --background */ background = true; break; @@ -234,7 +242,7 @@ index 88c9726..bcdce53 100644 case 'C': /* --no-close */ close_io = false; break; -@@ -1448,9 +1496,11 @@ parse_options(int argc, char * const *argv) +@@ -1453,9 +1502,11 @@ parse_options(int argc, char * const *argv) badusage("umask value must be a positive number"); } @@ -246,7 +254,7 @@ index 88c9726..bcdce53 100644 if (action == ACTION_NONE) badusage("need one of --start or --stop or --status"); -@@ -2298,7 +2348,8 @@ do_pidfile(const char *name) +@@ -2303,7 +2354,8 @@ do_pidfile(const char *name) if (match_mode == MATCH_PIDFILE && ((st.st_uid != getuid() && st.st_uid != 0) || diff --git a/start-stop-daemon.c b/start-stop-daemon.c index 88c9726..3947cc0 100644 --- a/start-stop-daemon.c +++ b/start-stop-daemon.c @@ -551,8 +551,8 @@ wait_for_child(pid_t pid) static void cleanup_socket_dir(void) { - unlink(notify_socket); - rmdir(notify_sockdir); + (void)unlink(notify_socket); + (void)rmdir(notify_sockdir); } static char * @@ -593,7 +593,7 @@ set_socket_passcred(int fd) #ifdef SO_PASSCRED static const int enable = 1; - setsockopt(fd, SOL_SOCKET, SO_PASSCRED, &enable, sizeof(enable)); + (void)setsockopt(fd, SOL_SOCKET, SO_PASSCRED, &enable, sizeof(enable)); #endif } @@ -807,6 +807,10 @@ daemonize(void) _exit(0); } + /* Close the notification socket, even though it is close-on-exec. */ + if (notify_await) + close(notify_fd); + /* Create a new session. */ if (setsid() < 0) fatale("cannot set session ID"); @@ -1359,6 +1363,7 @@ parse_options(int argc, char * const *argv) execname = optarg; break; case 'c': /* --chuid <username>|<uid> */ + free(changeuser); /* We copy the string just in case we need the * argument later. */ changeuser_len = strcspn(optarg, ":"); |