pidfile_read(): Reindent.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
Joachim Nilsson committed 2014-11-26 23:44:00 +01:00
1 parent 7f2c73468f
commit 939cfc2476
1 file changed
+20 -20
+20 -20
View File
@@ -131,31 +131,31 @@ void ifconfig(char *ifname, char *addr, char *mask, int up)
*/ */
pid_t pidfile_read(char *pidfile) pid_t pidfile_read(char *pidfile)
{ {
pid_t pid = 0; pid_t pid = 0;
char buf[16]; char buf[16];
FILE *fp; FILE *fp;
if (!pidfile) { if (!pidfile) {
errno = EINVAL; errno = EINVAL;
return -1; return -1;
} }
if (!fexist(pidfile)) if (!fexist(pidfile))
return -1; return -1;
fp = fopen(pidfile, "r"); fp = fopen(pidfile, "r");
if (!fp) if (!fp)
return -1; return -1;
if (fgets(buf, sizeof(buf), fp)) { if (fgets(buf, sizeof(buf), fp)) {
errno = 0; errno = 0;
pid = (pid_t)strtol(buf, NULL, 10); pid = (pid_t)strtol(buf, NULL, 10);
if (errno) if (errno)
pid = 0; /* Failed conversion. */ pid = 0; /* Failed conversion. */
} }
fclose(fp); fclose(fp);
return pid; return pid;
} }
/** /**