git://scm.lunaixsky.com
/
lunaix-os.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
chore: fix almost *ALL* warnings.
[lunaix-os.git]
/
lunaix-os
/
uprog
/
init.c
diff --git
a/lunaix-os/uprog/init.c
b/lunaix-os/uprog/init.c
index dd083add12be17fe2f84968ee6b83809bfd57290..b78cd3b360c293a055fbb4db217da3ff2eacfb29 100644
(file)
--- a/
lunaix-os/uprog/init.c
+++ b/
lunaix-os/uprog/init.c
@@
-1,3
+1,4
@@
+#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
#include <sys/lunaix.h>
#include <fcntl.h>
#include <stdio.h>
#include <sys/lunaix.h>
@@
-6,24
+7,29
@@
int
main(int argc, const char** argv)
{
int
main(int argc, const char** argv)
{
- int err
no
= 0;
+ int err = 0;
- if ((err
no
= open("/dev/tty", 0)) < 0) {
+ if ((err = open("/dev/tty", 0)) < 0) {
syslog(2, "fail to open tty (%d)\n", errno);
return 0;
}
syslog(2, "fail to open tty (%d)\n", errno);
return 0;
}
- if ((err
no = dup(errno
)) < 0) {
+ if ((err
= dup(err
)) < 0) {
syslog(2, "fail to setup tty i/o (%d)\n", errno);
return 0;
}
printf("(%p) user space!\n", (void*)main);
syslog(2, "fail to setup tty i/o (%d)\n", errno);
return 0;
}
printf("(%p) user space!\n", (void*)main);
+ if ((err = symlink("/usr", "/mnt/lunaix-os/usr"))) {
+ syslog(2, "symlink /usr:/mnt/lunaix-os/usr (%d)\n", errno);
+ return 0;
+ }
+
pid_t pid;
if (!(pid = fork())) {
pid_t pid;
if (!(pid = fork())) {
-
int err = execve("/mnt/lunaix-os/usr/ls
", NULL, NULL);
- printf("fail to execute (%d)\n", err);
+
err = execve("/usr/sh
", NULL, NULL);
+ printf("fail to execute (%d)\n", err
no
);
_exit(err);
}
_exit(err);
}