Fix file_exists() to deal with modern variant.

Update README.
This commit is contained in:
Nicholas J. Kain 2010-11-12 12:05:37 -05:00
parent 15f6bb66ee
commit 8aa6d9a320
2 changed files with 17 additions and 11 deletions

24
README
View File

@ -8,6 +8,8 @@ Linux kernel (tested: 2.4, 2.6)
C99-compliant C compiler (for C99 struct subobject init) C99-compliant C compiler (for C99 struct subobject init)
* any modern GCC should be sufficient * any modern GCC should be sufficient
CMake (tested: 2.8)
Tested with glibc 2.2.x and 2.3.x. dietlibc is not compatible. I have not yet Tested with glibc 2.2.x and 2.3.x. dietlibc is not compatible. I have not yet
tested uclibc. tested uclibc.
@ -57,10 +59,14 @@ USAGE
----- -----
1) Compile and install ifchd and ndhc. 1) Compile and install ifchd and ndhc.
a) Build ifchd with "make" a) Create a build directory:
b) Enter ndhc directory and build ndhc with "make" mkdir build && cd build
c) Install the ifchd and ndhc executables in a normal place. I would b) Create the makefiles:
suggest /usr/sbin or /usr/local/sbin. cmake ..
c) Build ifchd and ndhc:
make
d) Install the ifchd/ifchd and ndhc/ndhc executables in a normal place. I
would suggest /usr/sbin or /usr/local/sbin.
2) Time to create the jail in which ifchd and ndhc will run. 2) Time to create the jail in which ifchd and ndhc will run.
a) Become root and create new group "ifchd". a) Become root and create new group "ifchd".
@ -72,8 +78,8 @@ USAGE
b) Create new users "ifchd" and "dhcp". The primary group of these b) Create new users "ifchd" and "dhcp". The primary group of these
users should be "ifchd". users should be "ifchd".
# useradd -d /var/lib/ndhc -g ifchd ifchd # useradd -d /var/lib/ndhc -s /sbin/nologin -g ifchd ifchd
# useradd -d /var/lib/ndhc -g ifchd dhcp # useradd -d /var/lib/ndhc -s /sbin/nologin -g ifchd dhcp
b) Create the jail directory and set its ownership properly. b) Create the jail directory and set its ownership properly.
@ -105,9 +111,9 @@ USAGE
#!/bin/sh #!/bin/sh
case "$1" in case "$1" in
start) start)
ifchd -i eth0 -p /var/run/ifchd.pid -u ifchd -g ifchd -U dhcp -G ifchd \ ifchd -i wan0 -p /var/run/ifchd.pid -u ifchd -g ifchd -U dhcp \
-c /var/lib/ndhc &> /dev/null -G ifchd -c /var/lib/ndhc &> /dev/null
ndhc -b -i eth0 -u dhcp -C /var/lib/ndhc &> /dev/null ndhc -b -i wan0 -u dhcp -C /var/lib/ndhc &> /dev/null
;; ;;
stop) stop)
killall ndhc ifchd killall ndhc ifchd

View File

@ -1,5 +1,5 @@
/* ifchd.c - interface change daemon /* ifchd.c - interface change daemon
* Time-stamp: <2010-11-12 09:02:54 njk> * Time-stamp: <2010-11-12 12:04:25 njk>
* *
* (C) 2004 Nicholas J. Kain <njk@aerifal.cx> * (C) 2004 Nicholas J. Kain <njk@aerifal.cx>
* *
@ -878,7 +878,7 @@ int main(int argc, char** argv) {
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
if (!file_exists(pidfile, "w")) { if (file_exists(pidfile, "w") == -1) {
log_line("FATAL - cannot open pidfile for write!"); log_line("FATAL - cannot open pidfile for write!");
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }