mirror of
https://github.com/troglobit/finit.git
synced 2026-10-30 12:50:34 +00:00
Change creat() to open(), fix error tests
Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
This commit is contained in:
1 parent
89e6c35192
commit
2996545772
1 file changed
+3
-3
@@ -26,7 +26,7 @@
|
|||||||
sigaction(sig, &sa, NULL); \
|
sigaction(sig, &sa, NULL); \
|
||||||
} while(0)
|
} while(0)
|
||||||
|
|
||||||
#define touch(x) close(creat((x), 0644))
|
#define touch(x) close(open((x), O_CREAT|O_WRONLY|O_TRUNC, 0644))
|
||||||
|
|
||||||
|
|
||||||
void shutdown();
|
void shutdown();
|
||||||
@@ -108,7 +108,7 @@ int main()
|
|||||||
/*
|
/*
|
||||||
* Time adjustments
|
* Time adjustments
|
||||||
*/
|
*/
|
||||||
if ((fd = creat("/etc/adjtime", 0644)) < 0) {
|
if ((fd = open("/etc/adjtime", O_CREAT|O_WRONLY|O_TRUNC, 0644)) >= 0) {
|
||||||
write(fd, "0.0 0 0.0\n", 10);
|
write(fd, "0.0 0 0.0\n", 10);
|
||||||
close(fd);
|
close(fd);
|
||||||
}
|
}
|
||||||
@@ -141,7 +141,7 @@ int main()
|
|||||||
|
|
||||||
touch("/etc/network/run/ifstate");
|
touch("/etc/network/run/ifstate");
|
||||||
|
|
||||||
if ((f = fopen("/etc/hostname", "r")) == NULL) {
|
if ((f = fopen("/etc/hostname", "r")) != NULL) {
|
||||||
fgets(hline, 1023, f);
|
fgets(hline, 1023, f);
|
||||||
if ((x = strchr(hline, 0x0a)) != NULL)
|
if ((x = strchr(hline, 0x0a)) != NULL)
|
||||||
*x = 0;
|
*x = 0;
|
||||||
|
|||||||
Reference in new issue
Block a user