sysvinit-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [sysvinit-devel] [PATCH 0/5] init.c: add return tests for fprintf()


From: Michał Kulling
Subject: Re: [sysvinit-devel] [PATCH 0/5] init.c: add return tests for fprintf()
Date: Mon, 10 Feb 2014 22:13:57 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.3.0

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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]