Re: [Nagios-devel] base/utils.c improvements...

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
Guest

Re: [Nagios-devel] base/utils.c improvements...

Post by Guest »

Done. Thanks

On 16 Nov 2002 at 1:39, Harlan Stenn wrote:

> Near line 2740 is the place where an error message is printed if
> fcntl(lockfile,...) fails.
>
> The code there is a bit lame.
>
> Please consider changing the code from:
>
> if(fcntl(lockfile,F_SETLK,&lock) snprintf(temp_buffer,sizeof(temp_buffer)-1,"Lockfile '%s' is
> held by PID %d. Bailing out...",lock_file,(int)pid);
> write_to_logs_and_console(temp_buffer,NSLOG_RUNTIME_ERROR,TRUE);
> cleanup();
> exit(ERROR);
> }
>
> to:
> if(fcntl(lockfile,F_SETLK,&lock) if ((errno == EACCESS) || (errno == EAGAIN))
> snprintf(temp_buffer,sizeof(temp_buffer)-1,"Lockfile
> '%s' is held by PID %d. Bailing out...",lock_file,(int)lock.l_pid);
> else
> snprintf(temp_buffer,sizeof(temp_buffer)-1,"Cannot lock Lockfile '%s'; %s. Bailing out...",lock_file,strerror(errno));
> write_to_logs_and_console(temp_buffer,NSLOG_RUNTIME_ERROR,TRUE);
> cleanup();
> exit(ERROR);
> }
>
> Note the change from pid to lock.l_pid for the "existing" error message.
>
> H
>
>
>
>
> -------------------------------------------------------
> This sf.net email is sponsored by: To learn the basics of securing
> your web site with SSL, click here to get a FREE TRIAL of a Thawte
> Server Certificate: http://www.gothawte.com/rd524.html
> _______________________________________________
> Nagios-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/lis ... gios-devel
>



Ethan Galstad,
Nagios Developer
---
Email: [email protected]
Website: http://www.nagios.org






This post was automatically imported from historical nagios-devel mailing list archives
Original poster: [email protected]
Locked