bmsd/lock.c

changeset 746
44d929ff268e
parent 745
3addb8cfcc3e
child 747
b6fbe6821468
equal deleted inserted replaced
745:3addb8cfcc3e 746:44d929ff268e
54 syslog(LOG_NOTICE, "Can't create lockfile `%s': %s", tempfile, strerror(errno)); 54 syslog(LOG_NOTICE, "Can't create lockfile `%s': %s", tempfile, strerror(errno));
55 free(tempfile); 55 free(tempfile);
56 free(lockfile); 56 free(lockfile);
57 return 1; 57 return 1;
58 } 58 }
59 fprintf(fp, "%10u\n", getpid()); 59 fprintf(fp, "%u\n", getpid());
60 fclose(fp); 60 fclose(fp);
61 61
62 while (TRUE) { 62 while (TRUE) {
63 if (link(tempfile, lockfile) == 0) { 63 if (link(tempfile, lockfile) == 0) {
64 unlink(tempfile); 64 unlink(tempfile);

mercurial