diff options
author | Chris Hall <GMCH@hestia.halldom.com> | 2010-04-08 19:51:10 +0100 |
---|---|---|
committer | Chris Hall <GMCH@hestia.halldom.com> | 2010-04-08 19:51:10 +0100 |
commit | 83447a051fbcc88b33fcea6670520687668d3ba1 (patch) | |
tree | f3be10368d9fc6c605c1ec351bc7c1f2c0c61ff0 /lib/pid_output.c | |
parent | 17b711e6e4a4d5ce3728a07890434d890ebb76b4 (diff) | |
download | quagga-83447a051fbcc88b33fcea6670520687668d3ba1.tar.bz2 quagga-83447a051fbcc88b33fcea6670520687668d3ba1.tar.xz |
New functions for error numbers and addresses in messages.
Implemented less onerous ways of including descriptions of errors
and IP addresses in logging and other messages.
Implemented mapping of error numbers to error names, which is
generally more meaningful.
Diffstat (limited to 'lib/pid_output.c')
-rw-r--r-- | lib/pid_output.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/lib/pid_output.c b/lib/pid_output.c index 5261babc..17081dad 100644 --- a/lib/pid_output.c +++ b/lib/pid_output.c @@ -17,7 +17,7 @@ * You should have received a copy of the GNU General Public License * along with GNU Zebra; see the file COPYING. If not, write to the Free * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 02111-1307, USA. */ #include <zebra.h> @@ -39,7 +39,7 @@ pid_output (const char *path) oldumask = umask(0777 & ~PIDFILE_MASK); fp = fopen (path, "w"); - if (fp != NULL) + if (fp != NULL) { fprintf (fp, "%d\n", (int) pid); fclose (fp); @@ -49,7 +49,7 @@ pid_output (const char *path) /* XXX Why do we continue instead of exiting? This seems incompatible with the behavior of the fcntl version below. */ zlog_warn("Can't fopen pid lock file %s (%s), continuing", - path, safe_strerror(errno)); + path, errtoa(errno, 0).str); umask(oldumask); return -1; } @@ -63,7 +63,7 @@ pid_output (const char *path) int fd; pid_t pid; char buf[16]; - struct flock lock; + struct flock lock; mode_t oldumask; pid = getpid (); @@ -73,7 +73,7 @@ pid_output (const char *path) if (fd < 0) { zlog_err("Can't create pid lock file %s (%s), exiting", - path, safe_strerror(errno)); + path, errtoa(errno, 0).str); umask(oldumask); exit(1); } @@ -97,10 +97,10 @@ pid_output (const char *path) pidsize = strlen(buf); if ((tmp = write (fd, buf, pidsize)) != (int)pidsize) zlog_err("Could not write pid %d to pid_file %s, rc was %d: %s", - (int)pid,path,tmp,safe_strerror(errno)); + (int)pid,path,tmp, errtoa(errno, 0).str); else if (ftruncate(fd, pidsize) < 0) zlog_err("Could not truncate pid_file %s to %u bytes: %s", - path,(u_int)pidsize,safe_strerror(errno)); + path,(u_int)pidsize, errtoa(errno, 0).str); } return pid; } |