forked from DGNum/liminix
preinit: fix compiler warnings
This commit is contained in:
parent
155a29d9b3
commit
86a5224f3c
2 changed files with 6 additions and 11 deletions
|
@ -1,4 +1,5 @@
|
||||||
CFLAGS+=-Os -fno-stack-protector -fpic -fPIC
|
CFLAGS+=-Os -fno-stack-protector -fpic -fPIC
|
||||||
LDFLAGS=-static
|
LDFLAGS=-static
|
||||||
|
CFLAGS+=-Wall -Werror
|
||||||
|
|
||||||
preinit: preinit.o parseopts.o
|
preinit: preinit.o parseopts.o
|
||||||
|
|
|
@ -1,9 +1,12 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <stdlib.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <sys/mount.h>
|
#include <sys/mount.h>
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
#include <asm/setup.h> /* for COMMAND_LINE_SIZE */
|
#include <asm/setup.h> /* for COMMAND_LINE_SIZE */
|
||||||
|
|
||||||
|
@ -12,15 +15,6 @@ void parseopts(char * cmdline, char **root, char **rootfstype);
|
||||||
#define ERR(x) write(2, x, strlen(x))
|
#define ERR(x) write(2, x, strlen(x))
|
||||||
#define AVER(c) do { if(c < 0) ERR("failed: " #c); } while(0)
|
#define AVER(c) do { if(c < 0) ERR("failed: " #c); } while(0)
|
||||||
|
|
||||||
static int begins_with(char * str, char * prefix)
|
|
||||||
{
|
|
||||||
while(*prefix) {
|
|
||||||
if(*str == '\0') return 0;
|
|
||||||
if(*str != *prefix) return 0;
|
|
||||||
str++;
|
|
||||||
prefix++;
|
|
||||||
}
|
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int fork_exec(char * command, char *args[])
|
static int fork_exec(char * command, char *args[])
|
||||||
|
@ -28,7 +22,7 @@ static int fork_exec(char * command, char *args[])
|
||||||
int fork_pid = fork();
|
int fork_pid = fork();
|
||||||
AVER(fork_pid);
|
AVER(fork_pid);
|
||||||
if(fork_pid > 0)
|
if(fork_pid > 0)
|
||||||
wait(NULL);
|
return wait(NULL);
|
||||||
else
|
else
|
||||||
return execve(command, args, NULL);
|
return execve(command, args, NULL);
|
||||||
}
|
}
|
||||||
|
@ -40,7 +34,7 @@ int main(int argc, char *argv[], char *envp[])
|
||||||
{
|
{
|
||||||
char *rootdevice = 0;
|
char *rootdevice = 0;
|
||||||
char *rootfstype = 0;
|
char *rootfstype = 0;
|
||||||
char *p = buf;
|
|
||||||
write(1, banner, strlen(banner));
|
write(1, banner, strlen(banner));
|
||||||
|
|
||||||
mount("none", "/proc", "proc", 0, NULL);
|
mount("none", "/proc", "proc", 0, NULL);
|
||||||
|
|
Loading…
Reference in a new issue