diff options
author | Noriko Hosoi <nhosoi@redhat.com> | 2010-08-18 12:19:38 -0700 |
---|---|---|
committer | Noriko Hosoi <nhosoi@redhat.com> | 2010-08-20 13:07:37 -0700 |
commit | 26780f3c132dc5af43324e9ade5c5dc25838d80f (patch) | |
tree | 6bc102fc5fcf7cae7544381fc2af8d6d61257899 /lib | |
parent | 38310cc46336c4a3c238f1c3c43d80610111cd01 (diff) | |
download | ds-26780f3c132dc5af43324e9ade5c5dc25838d80f.tar.gz ds-26780f3c132dc5af43324e9ade5c5dc25838d80f.tar.xz ds-26780f3c132dc5af43324e9ade5c5dc25838d80f.zip |
Bug 616500 - fix coverity Defect Type: Resource leaks issues CID 12094 - 12136
https://bugzilla.redhat.com/show_bug.cgi?id=616500
coverity ID 12135
Comment: Getting rid of unused functions fopen_l and fclose_l
from lib/libadmin/util.c.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libadmin/util.c | 48 |
1 files changed, 0 insertions, 48 deletions
diff --git a/lib/libadmin/util.c b/lib/libadmin/util.c index 1c6134d4..bbc6804b 100644 --- a/lib/libadmin/util.c +++ b/lib/libadmin/util.c @@ -81,54 +81,6 @@ char *get_flock_path(void) return result; } -/* Open a file with locking, close a file with unlocking. */ -FILE *fopen_l(char *path, char *mode) -{ - FILE *f = fopen(path, mode); - char *lockpath; - char *sn="admserv"; - char *flp=get_flock_path(); - - if(f == NULL) return NULL; - lockpath=(char *) MALLOC(strlen(sn)+strlen(flp)+16); - sprintf(lockpath, flp, sn); -#ifdef XP_UNIX - if( (lf=system_fopenRW(lockpath)) == SYS_ERROR_FD) - report_error(FILE_ERROR, lockpath, "Could not open file."); - if(system_flock(lf)==IO_ERROR) - report_error(FILE_ERROR, lockpath, "Could not lock file."); -#elif defined(XP_WIN32) - /* Using mutexes because if the CGI program dies, the mutex will be - * automatically released by the OS for another process to grab. - * Semaphores do not have this property; and if the CGI program crashes, - * the admin server would be effectively crippled. - */ - if ( (lf = CreateMutex(NULL, 0, lockpath)) == NULL) { - report_error(FILE_ERROR, lockpath, "Could not create admin mutex."); - } else { - if ( WaitForSingleObject(lf, 60*1000) == WAIT_FAILED) { - report_error(FILE_ERROR, lockpath, "Unable to obtain mutex after 60 seconds."); - } - } -#endif /* XP_UNIX */ - return f; -} - -void fclose_l(FILE *f) -{ - fclose(f); -#ifdef XP_UNIX - if(system_ulock(lf)==IO_ERROR) - report_error(FILE_ERROR, NULL, "Could not unlock lock file."); - system_fclose(lf); -#elif defined(XP_WIN32) - if (lf) { - ReleaseMutex(lf); - CloseHandle(lf); - } -#endif /* XP_UNIX */ -} - char *alert_word_wrap(char *str, int width, char *linefeed) { char *ans = NULL; |