A possible fix:

diff -ruN zcip-4_orig/lockfile.c zcip-4/lockfile.c
--- zcip-4_orig/lockfile.c      2005-04-05 18:05:10.000000000 -0700
+++ zcip-4/lockfile.c   2005-04-05 18:03:44.000000000 -0700
@@ -11,19 +11,25 @@
 #define LOCKDIR        "/var/run"
 #define LOCKPREFIX     "/zcip."
 
-int
-lock_check(char * device)
+static void
+gen_lockfile_name(char * nbuf, char * device)
 {
-   FILE * fd;
-   char nbuf[128];
    char * p;
-   int i;
-
+   
    p = strrchr(device, '/');
    strcpy(nbuf, LOCKDIR LOCKPREFIX);
    if( p ) strcat(nbuf, p+1);
    else    strcat(nbuf, device);
+}
+
+int
+lock_check(char * device)
+{
+   FILE * fd;
+   char nbuf[128];
+   int i;
 
+   gen_lockfile_name(nbuf, device);
    fd = fopen(nbuf, "r");
    if( fd )
    {
@@ -34,7 +40,8 @@
       if( unlink(nbuf) == -1 ) return 0;
    }
    fd = fopen(nbuf, "w"); /* Got it! */
-   fprintf(fd, "%10d\n", getpid());
+   i = getpid();
+   fprintf(fd, "%d\n", i);
    fclose(fd);
    return 1;
 }
@@ -44,14 +51,9 @@
 {
    FILE * fd;
    char nbuf[128];
-   char * p;
    int i;
 
-   p = strrchr(device, '/');
-   strcpy(nbuf, LOCKDIR LOCKPREFIX);
-   if( p ) strcat(nbuf, p+1);
-   else    strcat(nbuf, device);
-
+   gen_lockfile_name(nbuf, device);
    fd = fopen(nbuf, "r");
    if( fd )
    {




-- 
_______________________________________________
NEW! Lycos Dating Search. The only place to search multiple dating sites at 
once.
http://datingsearch.lycos.com


Reply via email to