Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 41520 Details for
Bug 67060
smbpwman-0.5-r2 (new package)
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Fix locking to prevent multiple daemons from running
fix-lock.patch (text/plain), 1.53 KB, created by
chris-gentoo
on 2004-10-11 02:23:48 UTC
(
hide
)
Description:
Fix locking to prevent multiple daemons from running
Filename:
MIME Type:
Creator:
chris-gentoo
Created:
2004-10-11 02:23:48 UTC
Size:
1.53 KB
patch
obsolete
>diff -ur smbpwman-0.5.orig/smbpwman.c smbpwman-0.5/smbpwman.c >--- smbpwman-0.5.orig/smbpwman.c 2004-09-22 13:20:06.000000000 +1000 >+++ smbpwman-0.5/smbpwman.c 2004-09-22 13:50:20.000000000 +1000 >@@ -43,6 +43,7 @@ > * Expire cached passwords after short timeout > * Add flush and flushall requests > * Rename shared functions to avoid naming collisions >+ * Hold server pid file lock until shutdown > * Patched by Chris Jensen - 19 Aug 2004 > * Clear passwords after first use > * Overwrite passwords with 0x00 before freeing memory >@@ -60,6 +61,7 @@ > #include <stdarg.h> > #include <syslog.h> > #include <time.h> >+#include <sys/file.h> > > /* Reference counter is necissary otherwise > * the sequence store, store, retrieve, retrieve >@@ -245,6 +247,7 @@ > char result; > int verbose = 0; > FILE *lock; >+ int lock_result; > pid_t cpid; > > // verify that the socket path is secure... >@@ -258,7 +261,8 @@ > // create the lock file to make sure that this is the only process running... > umask(0077); > lock = fopen(PID_NAME, "w"); >- if(lock == NULL) >+ lock_result = flock(fileno(lock), LOCK_EX | LOCK_NB); >+ if((lock == NULL) || (lock_result == -1)) > { > print_version(); > fprintf(stderr, "Could not write lock file. Is daemon already running?\n"); >@@ -301,8 +305,6 @@ > > fprintf(lock, "%d\n", getpid()); > >- fclose(lock); >- > if (!verbose) > { > close(0); >@@ -392,6 +394,8 @@ > } > log(LOG_INFO, "shutdown request. daemon terminating\n"); > cache_flush(1); >+ fclose(lock); >+ remove(PID_NAME); > return 0; > break; > #ifdef DEBUG
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 67060
:
41513
|
41514
|
41515
|
41516
|
41517
|
41518
|
41519
| 41520 |
41521
|
41522
|
41523
|
41524