W dniu 10.02.2014 21:37, Petter Reinholdtsen pisze:
--- init.c-orig 2014-02-10 20:41:50.922024360 +0100
+++ init.c 2014-02-10 20:40:09.786021955 +0100
@@ -372,34 +372,74 @@
case C_REC:
break;
case D_RUNLEVEL:
- fscanf(f, "%c\n", &runlevel);
- break;
+ if(fscanf(f, "%c\n", &runlevel) < 0){
+ fprintf(stderr, "Read state pipe:
%s\n", strerror(errno));
+ oops_error = -1;
+ return NULL;
+ }
+ break;
Perhaps the if(fscanf)...} part should be made into a function or
macro, to avoid duplicate code? It is repeated quite a lot of times.
Yeah, it's not a good code, I'll change it tomorrow.
--
Michal Kulling