fix segfault in locking utility
authorFelix Fietkau <nbd@openwrt.org>
Tue, 11 Apr 2006 13:54:43 +0000 (13:54 +0000)
committerFelix Fietkau <nbd@openwrt.org>
Tue, 11 Apr 2006 13:54:43 +0000 (13:54 +0000)
SVN-Revision: 3617

openwrt/package/busybox/patches/340-lock_util.patch

index de510551c04ea5bb952c688d730fe827bb79f5ec..9e2075da1761bfb0c76f06245f28b26d2c18e9f9 100644 (file)
@@ -41,7 +41,7 @@ diff -urN busybox.old/miscutils/Makefile.in busybox.dev/miscutils/Makefile.in
 diff -urN busybox.old/miscutils/lock.c busybox.dev/miscutils/lock.c
 --- busybox.old/miscutils/lock.c       1970-01-01 01:00:00.000000000 +0100
 +++ busybox.dev/miscutils/lock.c       2006-03-14 09:50:40.000000000 +0100
-@@ -0,0 +1,125 @@
+@@ -0,0 +1,128 @@
 +#include <sys/types.h>
 +#include <sys/file.h>
 +#include <sys/stat.h>
@@ -79,10 +79,13 @@ diff -urN busybox.old/miscutils/lock.c busybox.dev/miscutils/lock.c
 +      FILE *f;
 +      int i;
 +      
-+      f = fopen(file, "r");
++      if ((f = fopen(file, "r")) == NULL)
++              return 0;
++      
 +      fscanf(f, "%d", &i);
 +      if (i > 0)
 +              kill(i, SIGTERM);
++      
 +      fclose(f);
 +
 +      return 0;