]> git.ipfire.org Git - thirdparty/squid.git/blobdiff - src/DiskIO/DiskDaemon/diskd.cc
Source Format Enforcement (#763)
[thirdparty/squid.git] / src / DiskIO / DiskDaemon / diskd.cc
index 267e28c3d6ccb03ecfe64187ac2b3b6e856fe3e3..e0588bba1fb0b1735277f5dbaccb904a6f0d7a56 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 1996-2014 The Squid Software Foundation and contributors
+ * Copyright (C) 1996-2021 The Squid Software Foundation and contributors
  *
  * Squid software is distributed under GPLv2+ license and includes
  * contributions from numerous individuals and organizations.
@@ -51,7 +51,7 @@ static char *shmbuf;
 static int DebugLevel = 0;
 
 static int
-do_open(diomsg * r, int len, const char *buf)
+do_open(diomsg * r, int, const char *buf)
 {
     int fd;
     file_state *fs;
@@ -85,7 +85,7 @@ do_open(diomsg * r, int len, const char *buf)
 }
 
 static int
-do_close(diomsg * r, int len)
+do_close(diomsg * r, int)
 {
     int fd;
     file_state *fs;
@@ -115,7 +115,7 @@ do_close(diomsg * r, int len)
 }
 
 static int
-do_read(diomsg * r, int len, char *buf)
+do_read(diomsg * r, int, char *buf)
 {
     int x;
     int readlen = r->size;
@@ -165,7 +165,7 @@ do_read(diomsg * r, int len, char *buf)
 }
 
 static int
-do_write(diomsg * r, int len, const char *buf)
+do_write(diomsg * r, int, const char *buf)
 {
     int wrtlen = r->size;
     int x;
@@ -211,7 +211,7 @@ do_write(diomsg * r, int len, const char *buf)
 }
 
 static int
-do_unlink(diomsg * r, int len, const char *buf)
+do_unlink(diomsg * r, int, const char *buf)
 {
     if (unlink(buf) < 0) {
         DEBUG(1) {
@@ -295,11 +295,8 @@ fsHash(const void *key, unsigned int n)
     return (*k & (--n));
 }
 
-SQUIDCEXTERN {
-    static void
-    alarm_handler(int sig) {
-        (void) 0;
-    }
+extern "C" {
+    static void alarm_handler(int) {}
 };
 
 int
@@ -324,7 +321,7 @@ main(int argc, char *argv[])
 
     if (rmsgid < 0) {
         perror("msgget");
-        return 1;
+        exit(EXIT_FAILURE);
     }
 
     key = atoi(argv[2]);
@@ -332,7 +329,7 @@ main(int argc, char *argv[])
 
     if (smsgid < 0) {
         perror("msgget");
-        return 1;
+        exit(EXIT_FAILURE);
     }
 
     key = atoi(argv[3]);
@@ -340,21 +337,21 @@ main(int argc, char *argv[])
 
     if (shmid < 0) {
         perror("shmget");
-        return 1;
+        exit(EXIT_FAILURE);
     }
 
     shmbuf = (char *)shmat(shmid, NULL, 0);
 
     if (shmbuf == (void *) -1) {
         perror("shmat");
-        return 1;
+        exit(EXIT_FAILURE);
     }
 
     hash = hash_create(fsCmp, 1 << 4, fsHash);
     assert(hash);
     if (fcntl(0, F_SETFL, SQUID_NONBLOCK) < 0) {
-        perror(xstrerror());
-        return 1;
+        perror(xstrerr(errno));
+        exit(EXIT_FAILURE);
     }
     memset(&sa, '\0', sizeof(sa));
     sa.sa_handler = alarm_handler;
@@ -416,5 +413,6 @@ main(int argc, char *argv[])
     if (shmctl(shmid, IPC_RMID, 0) < 0)
         perror("shmctl IPC_RMID");
 
-    return 0;
+    return EXIT_SUCCESS;
 }
+