Package: nstx Version: 1.1-beta6-4 Severity: normal Tags: patch If the chroot dir (/var/run/nstxd by default) doesn't exist, nstxd fails to start, e.g. if /var/run is on a RAM fs (tmpfs). The attached patch tries to create the chroot dir, before chroot()'ing to it. This should match the behaviour of other daemons.
-- System Information: Debian Release: lenny/sid APT prefers stable APT policy: (500, 'stable') Architecture: arm (armv5tel) Shell: /bin/sh linked to /bin/bash Kernel: Linux 2.6.18-4-ixp4xx Locale: LANG=da_DK.UTF-8, LC_CTYPE=da_DK.UTF-8 (charmap=UTF-8) Versions of packages nstx depends on: ii adduser 3.102 Add and remove users and groups ii libc6 2.3.6.ds1-13 GNU C Library: Shared libraries nstx recommends no packages. -- no debconf information
Index: nstx-1.1-beta6/nstxd.c =================================================================== --- nstx-1.1-beta6.orig/nstxd.c 2007-05-16 12:41:15.000000000 +0200 +++ nstx-1.1-beta6/nstxd.c 2007-05-16 12:50:41.000000000 +0200 @@ -22,6 +22,7 @@ #include <stdio.h> #include <string.h> #include <unistd.h> +#include <sys/stat.h> #include <sys/types.h> #include <sys/socket.h> #include <fcntl.h> @@ -127,6 +128,13 @@ if (dir) { /* Open the log-socket now (with LOG_NDELAY) before chroot-ing */ openlog(argv[0], LOG_PERROR|LOG_PID|LOG_CONS|LOG_NDELAY, LOG_DAEMON); + + /* Make sure the chroot dir exists */ + if (mkdir(dir, 0755) < 0 && errno != EEXIST) { + syslog(LOG_ERR, "Can't create chroot dir %s: %m", dir); + exit(EXIT_FAILURE); + } + if (chroot(dir)) { syslog(LOG_ERR, "Can't chroot to %s: %m", dir); exit(EXIT_FAILURE); /* Too many possible causes */