Skip to content
Snippets Groups Projects
Commit 39eb9b16 authored by Felix Fietkau's avatar Felix Fietkau
Browse files

fix segfault in locking utility

SVN-Revision: 3617
parent e8e55bc4
No related branches found
No related tags found
No related merge requests found
...@@ -39,7 +39,7 @@ diff -urN busybox.old/miscutils/Makefile.in busybox.dev/miscutils/Makefile.in ...@@ -39,7 +39,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 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.old/miscutils/lock.c 1970-01-01 01:00:00.000000000 +0100
+++ busybox.dev/miscutils/lock.c 2006-04-05 01:07:12.000000000 +0200 +++ busybox.dev/miscutils/lock.c 2006-04-05 01:07:12.000000000 +0200
@@ -0,0 +1,125 @@ @@ -0,0 +1,128 @@
+#include <sys/types.h> +#include <sys/types.h>
+#include <sys/file.h> +#include <sys/file.h>
+#include <sys/stat.h> +#include <sys/stat.h>
...@@ -77,10 +77,13 @@ diff -urN busybox.old/miscutils/lock.c busybox.dev/miscutils/lock.c ...@@ -77,10 +77,13 @@ diff -urN busybox.old/miscutils/lock.c busybox.dev/miscutils/lock.c
+ FILE *f; + FILE *f;
+ int i; + int i;
+ +
+ f = fopen(file, "r"); + if ((f = fopen(file, "r")) == NULL)
+ return 0;
+
+ fscanf(f, "%d", &i); + fscanf(f, "%d", &i);
+ if (i > 0) + if (i > 0)
+ kill(i, SIGTERM); + kill(i, SIGTERM);
+
+ fclose(f); + fclose(f);
+ +
+ return 0; + return 0;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment