mirror of
https://github.com/troglobit/finit.git
synced 2026-11-08 16:11:10 +00:00
Fixed minor errors and typos
Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
This commit is contained in:
1 parent
64b95a972a
commit
a4c8150c77
1 file changed
+15
-8
@@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
#include <stdout.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <sys/mount.h>
|
#include <sys/mount.h>
|
||||||
@@ -8,6 +8,9 @@
|
|||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <dirent.h>
|
#include <dirent.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
#include <signal.h>
|
||||||
|
#include <sys/wait.h>
|
||||||
|
#include <linux/fs.h>
|
||||||
#include <linux/reboot.h>
|
#include <linux/reboot.h>
|
||||||
|
|
||||||
|
|
||||||
@@ -24,6 +27,9 @@
|
|||||||
#define touch(x) close(creat((x), 0644))
|
#define touch(x) close(creat((x), 0644))
|
||||||
|
|
||||||
|
|
||||||
|
void shutdown();
|
||||||
|
void wait_all();
|
||||||
|
|
||||||
void dummy()
|
void dummy()
|
||||||
{
|
{
|
||||||
/* do nothing */
|
/* do nothing */
|
||||||
@@ -51,7 +57,7 @@ int main(int argv, char **argc)
|
|||||||
* Signal management
|
* Signal management
|
||||||
*/
|
*/
|
||||||
for (i = 1; i < NSIG; i++)
|
for (i = 1; i < NSIG; i++)
|
||||||
SETSIG(sa, f, SIG_IGN, SA_RESTART);
|
SETSIG(sa, i, SIG_IGN, SA_RESTART);
|
||||||
|
|
||||||
SETSIG(sa, SIGINT, shutdown, 0);
|
SETSIG(sa, SIGINT, shutdown, 0);
|
||||||
SETSIG(sa, SIGPWR, dummy, 0);
|
SETSIG(sa, SIGPWR, dummy, 0);
|
||||||
@@ -82,7 +88,7 @@ int main(int argv, char **argc)
|
|||||||
close(1);
|
close(1);
|
||||||
close(2);
|
close(2);
|
||||||
}
|
}
|
||||||
fclose(s);
|
fclose(f);
|
||||||
}
|
}
|
||||||
|
|
||||||
setsid();
|
setsid();
|
||||||
@@ -100,7 +106,7 @@ int main(int argv, char **argc)
|
|||||||
/*
|
/*
|
||||||
* Time adjustments
|
* Time adjustments
|
||||||
*/
|
*/
|
||||||
if ((fd = open("/etc/adjtime")) < 0) {
|
if ((fd = creat("/etc/adjtime", 0644)) < 0) {
|
||||||
write(fd, "0.0 0 0.0\n", 10);
|
write(fd, "0.0 0 0.0\n", 10);
|
||||||
close(fd);
|
close(fd);
|
||||||
}
|
}
|
||||||
@@ -114,9 +120,10 @@ int main(int argv, char **argc)
|
|||||||
|
|
||||||
if ((dir = opendir("/etc/resolvconf/run/interface")) != NULL) {
|
if ((dir = opendir("/etc/resolvconf/run/interface")) != NULL) {
|
||||||
while ((d = readdir(dir)) != NULL) {
|
while ((d = readdir(dir)) != NULL) {
|
||||||
if (isalnum(d.name[0]))
|
if (isalnum(d->d_name[0]))
|
||||||
continue;
|
continue;
|
||||||
sprintf(filename, "/etc/resolvconf/run/interface/%s", d.name);
|
sprintf(filename, "/etc/resolvconf/run/interface/%s",
|
||||||
|
d->d_name);
|
||||||
unlink(filename);
|
unlink(filename);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -172,7 +179,7 @@ int main(int argv, char **argc)
|
|||||||
sigemptyset(&nmask1);
|
sigemptyset(&nmask1);
|
||||||
sigemptyset(&nmask2);
|
sigemptyset(&nmask2);
|
||||||
sigaddset(&nmask2, SIGCHLD);
|
sigaddset(&nmask2, SIGCHLD);
|
||||||
sigprocmask(SIG_UNBLOCK, nmask2, NULL);
|
sigprocmask(SIG_UNBLOCK, &nmask2, NULL);
|
||||||
|
|
||||||
for (i = 0; i < NSIG; i++)
|
for (i = 0; i < NSIG; i++)
|
||||||
sigaction(i, nmask3, NULL);
|
sigaction(i, nmask3, NULL);
|
||||||
@@ -238,6 +245,6 @@ void wait_all()
|
|||||||
int status;
|
int status;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
wait(&status, WNOHANG);
|
waitpid(-1, &status, WNOHANG);
|
||||||
} while (errno != ECHILD);
|
} while (errno != ECHILD);
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user