- Minor cleanups
authormichael <michael@82007160-df01-0410-b94d-b575c5fd34c7>
Mon, 22 Dec 2014 19:38:06 +0000 (19:38 +0000)
committermichael <michael@82007160-df01-0410-b94d-b575c5fd34c7>
Mon, 22 Dec 2014 19:38:06 +0000 (19:38 +0000)
git-svn-id: svn://svn.ircd-hybrid.org/svnroot/hopm/trunk@5082 82007160-df01-0410-b94d-b575c5fd34c7

src/main.c

index bdabfe8d1758d038a7bd41c77b39b5abe8368791..107377f86867816b02bf39d38bc055796318fc64 100644 (file)
@@ -70,9 +70,8 @@ struct sigaction ALARMACTION;
 struct sigaction INTACTION;
 struct sigaction USR1ACTION;
 
-int main(int argc, char **argv)
+int main(int argc, char *argv[])
 {
-   char spid[16];
    pid_t pid;
    int c;
    size_t lenc, lenl;
@@ -155,22 +154,22 @@ int main(int argc, char **argv)
    if (OptionsItem->scanlog)
       scanlog_open(OptionsItem->scanlog);
 
-   pid = getpid();
+    pidout = fopen(OptionsItem->pidfile, "w");
 
-   pidout = fopen(OptionsItem->pidfile, "w");
-   snprintf(spid, 16, "%u", pid);
+    if (pidout)
+    {
+      char spid[16];
 
-   if (pidout)
-   {
+      snprintf(spid, sizeof(spid), "%u", getpid());
       fwrite(spid, sizeof(char), strlen(spid), pidout);
       fclose(pidout);
-   }
-   else
-   {
-      log_printf("MAIN -> Error opening %s: %s", OptionsItem->pidfile,
-          strerror(errno));
-      exit(EXIT_FAILURE);
-   }
+    }
+    else
+    {
+       log_printf("MAIN -> Error opening %s: %s", OptionsItem->pidfile,
+                  strerror(errno));
+       exit(EXIT_FAILURE);
+    }
 
    /* Setup alarm & int handlers. */