[procps] Re: [PATCH 0/2] Two small patches for sysctl.c

  • From: "Dr. Werner Fink" <werner@xxxxxxx>
  • To: Craig Small <csmall@xxxxxxxxxx>
  • Date: Mon, 21 Aug 2017 16:50:11 +0200

On Sat, Aug 19, 2017 at 11:22:21PM +0000, Craig Small wrote:

Hi Werner,
  Those two small patches have been applied, I'm working on moving them
onto the newlib branch too.

 - Craig

Thanks a lot, meanwhile I've detected a problem with the setvbuf
in case not having open a file

Werner
Index: procps-ng-3.3.9/sysctl.c
===================================================================
--- procps-ng-3.3.9.orig/sysctl.c
+++ procps-ng-3.3.9/sysctl.c
@@ -219,7 +219,7 @@ static int ReadSetting(const char *restr
 
        fp = fopen(tmpname, "r");
 
-       if (iobuf)
+       if (iobuf && fp)
                setvbuf(fp, iobuf, _IOFBF, IOBUFSIZ);
 
        if (!fp) {
@@ -443,7 +443,7 @@ static int WriteSetting(const char *sett
 
        fp = fopen(tmpname, "w");
 
-       if (iobuf)
+       if (iobuf && fp)
                setvbuf(fp, iobuf, _IOFBF, IOBUFSIZ);
 
        if (!fp) {

Attachment: signature.asc
Description: PGP signature

Other related posts: