Fixed fuckups
This commit is contained in:
parent
163a31070d
commit
99976bf2a6
3
Makefile
3
Makefile
@ -21,5 +21,4 @@ uninstall:
|
|||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm bin/grub2-se-verifyserv
|
rm bin/grub2-se-verifyserv
|
||||||
|
rmdir bin
|
||||||
|
|
||||||
|
@ -59,7 +59,6 @@ int main(int argc, char *argv[]){
|
|||||||
int verbose = 0;
|
int verbose = 0;
|
||||||
int statval;
|
int statval;
|
||||||
|
|
||||||
|
|
||||||
// Argument handling
|
// Argument handling
|
||||||
for(int i=0; i<argc; i++){
|
for(int i=0; i<argc; i++){
|
||||||
if(!strcmp(argv[i], "--help") || !strcmp(argv[i], "-h")){
|
if(!strcmp(argv[i], "--help") || !strcmp(argv[i], "-h")){
|
||||||
@ -77,7 +76,6 @@ int main(int argc, char *argv[]){
|
|||||||
while(1){
|
while(1){
|
||||||
|
|
||||||
if(fork() == 0){
|
if(fork() == 0){
|
||||||
|
|
||||||
// Exec program silently by default
|
// Exec program silently by default
|
||||||
if(!verbose){
|
if(!verbose){
|
||||||
int fd = open("/dev/null", O_WRONLY | O_CREAT, 0666);
|
int fd = open("/dev/null", O_WRONLY | O_CREAT, 0666);
|
||||||
@ -92,8 +90,8 @@ int main(int argc, char *argv[]){
|
|||||||
else{
|
else{
|
||||||
if(execlp(PROGRAM, PROGRAM, NULL) < 0)
|
if(execlp(PROGRAM, PROGRAM, NULL) < 0)
|
||||||
exec_failed();
|
exec_failed();
|
||||||
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
@ -101,27 +99,23 @@ int main(int argc, char *argv[]){
|
|||||||
printf("Waiting for %d...\n", getpid());
|
printf("Waiting for %d...\n", getpid());
|
||||||
|
|
||||||
wait(&statval);
|
wait(&statval);
|
||||||
if(WIFEXITED(statval)){
|
if(verbose)
|
||||||
if(verbose)
|
printf("Exit: %d\n", statval);
|
||||||
printf("Exit: %d\n", statval);
|
|
||||||
|
|
||||||
if(statval == STATUS_OK){
|
if(statval == STATUS_OK){
|
||||||
// If exit is STATUS_OK, write file with nothing in it
|
// If exit is STATUS_OK, write file with nothing in it
|
||||||
FILE *f = fopen(VRFFILE, "w");
|
FILE *f = fopen(VRFFILE, "w");
|
||||||
if(f == NULL){
|
if(f == NULL){
|
||||||
printf("ERROR opening file");
|
printf("ERROR opening file");
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
fclose(f);
|
|
||||||
}
|
|
||||||
else if(statval == 256){
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
else
|
fclose(f);
|
||||||
// If exit != 0
|
|
||||||
if(access(VRFFILE, F_OK) != -1) //File exists?
|
|
||||||
unlink(VRFFILE);
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
// If exit != 0
|
||||||
|
if(access(VRFFILE, F_OK) != -1) //File exists?
|
||||||
|
unlink(VRFFILE);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sleep(SLEEP);
|
sleep(SLEEP);
|
||||||
|
Loading…
Reference in New Issue
Block a user