]> granicus.if.org Git - apache/commitdiff
get rid of some bogus uses of perror()
authorJeff Trawick <trawick@apache.org>
Tue, 9 Jan 2001 04:40:22 +0000 (04:40 +0000)
committerJeff Trawick <trawick@apache.org>
Tue, 9 Jan 2001 04:40:22 +0000 (04:40 +0000)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@87627 13f79535-47bb-0310-9956-ffa450edef68

server/mpm/dexter/scoreboard.c
server/mpm/mpmt_pthread/scoreboard.c
server/mpm/perchild/scoreboard.c
server/mpm/prefork/prefork.c

index 3bf4869a6432e739552e3cf899c6cdaffdd69c12..e3cbd9b15898322c4c42d6dc29a45cf0ee33e88d 100644 (file)
@@ -99,20 +99,23 @@ apr_status_t ap_cleanup_shared_mem(void *d)
 static void setup_shared_mem(apr_pool_t *p)
 {
     char buf[512];
+    char errmsg[120];
     const char *fname;
+    apr_status_t rv;
 
     fname = ap_server_root_relative(p, ap_scoreboard_fname);
-    if (apr_shm_init(&scoreboard_shm, SCOREBOARD_SIZE, fname, p) != APR_SUCCESS) {
-        apr_snprintf(buf, sizeof(buf), "%s: could not open(create) scoreboard",
-                    ap_server_argv0);
-        perror(buf);
+    rv = apr_shm_init(&scoreboard_shm, SCOREBOARD_SIZE, fname, p);
+    if (rv != APR_SUCCESS) {
+        apr_snprintf(buf, sizeof(buf), "%s: could not open(create) scoreboard: %s",
+                    ap_server_argv0, apr_strerror(rv, errmsg, sizeof errmsg));
+        fprintf(stderr, "%s\n", buf);
         exit(APEXIT_INIT);
     }
     ap_scoreboard_image = apr_shm_malloc(scoreboard_shm, SCOREBOARD_SIZE);
     if (ap_scoreboard_image == NULL) {
         apr_snprintf(buf, sizeof(buf), "%s: cannot allocate scoreboard",
                     ap_server_argv0);
-        perror(buf);
+        perror(buf); /* o.k. since MM sets errno */
         apr_shm_destroy(scoreboard_shm);
         exit(APEXIT_INIT);
     }
index a2c190504993dc535a878b428260237f4baedaec..d701a11dbf9073c1c999dedc1e2d995830689250 100644 (file)
@@ -106,27 +106,31 @@ apr_status_t ap_cleanup_shared_mem(void *d)
 static void setup_shared_mem(apr_pool_t *p)
 {
     char buf[512];
+    char errmsg[120];
     const char *fname;
+    apr_status_t rv;
 
     fname = ap_server_root_relative(p, ap_scoreboard_fname);
-    if (apr_shm_init(&scoreboard_shm, SCOREBOARD_SIZE, fname, p) != APR_SUCCESS) {
-        apr_snprintf(buf, sizeof(buf), "%s: could not open(create) scoreboard",
-                    ap_server_argv0);
-        perror(buf);
+    rv = apr_shm_init(&scoreboard_shm, SCOREBOARD_SIZE, fname, p);
+    if (rv != APR_SUCCESS) {
+        apr_snprintf(buf, sizeof(buf), "%s: could not open(create) scoreboard: %s",
+                    ap_server_argv0, apr_strerror(rv, errmsg, sizeof errmsg));
+        fprintf(stderr, "%s\n", buf);
         exit(APEXIT_INIT);
     }
     ap_scoreboard_image = apr_shm_malloc(scoreboard_shm, SCOREBOARD_SIZE);
-    if (apr_shm_init(&status_shm, NEW_SCOREBOARD_SIZE, fname, p) != APR_SUCCESS) {
-        apr_snprintf(buf, sizeof(buf), "%s: could not open(create) scoreboard",
-                    ap_server_argv0);
-        perror(buf);
+    rv = apr_shm_init(&status_shm, NEW_SCOREBOARD_SIZE, fname, p);
+    if (rv != APR_SUCCESS) {
+        apr_snprintf(buf, sizeof(buf), "%s: could not open(create) scoreboard: %s",
+                    ap_server_argv0, apr_strerror(rv, errmsg, sizeof errmsg));
+        fprintf(stderr, "%s\n", buf);
         exit(APEXIT_INIT);
     }
     ap_new_scoreboard_image = apr_shm_malloc(status_shm, NEW_SCOREBOARD_SIZE);
     if (ap_scoreboard_image == NULL || ap_new_scoreboard_image == NULL) {
         apr_snprintf(buf, sizeof(buf), "%s: cannot allocate scoreboard",
                     ap_server_argv0);
-        perror(buf);
+        perror(buf); /* o.k. since MM sets errno */
         apr_shm_destroy(scoreboard_shm);
         apr_shm_destroy(status_shm);
         exit(APEXIT_INIT);
index 10b0730ad425aca90182efe3ce944b7cc712c833..7d2e1de8900134b96cd8b63bebb3a801bea4cd5d 100644 (file)
@@ -99,20 +99,23 @@ apr_status_t ap_cleanup_shared_mem(void *d)
 static void setup_shared_mem(apr_pool_t *p)
 {
     char buf[512];
+    char errmsg[120];
     const char *fname;
+    apr_status_t rv;
 
     fname = ap_server_root_relative(p, ap_scoreboard_fname);
-    if (apr_shm_init(&scoreboard_shm, SCOREBOARD_SIZE, fname, p) != APR_SUCCESS) {
-        apr_snprintf(buf, sizeof(buf), "%s: could not open(create) scoreboard",
-                    ap_server_argv0);
-        perror(buf);
+    rv = apr_shm_init(&scoreboard_shm, SCOREBOARD_SIZE, fname, p);
+    if (rv != APR_SUCCESS) {
+        apr_snprintf(buf, sizeof(buf), "%s: could not open(create) scoreboard: %s",
+                    ap_server_argv0, apr_strerror(rv, errmsg, sizeof errmsg));
+        fprintf(stderr, "%s\n", buf);
         exit(APEXIT_INIT);
     }
     ap_scoreboard_image = apr_shm_malloc(scoreboard_shm, SCOREBOARD_SIZE);
     if (ap_scoreboard_image == NULL) {
         apr_snprintf(buf, sizeof(buf), "%s: cannot allocate scoreboard",
                     ap_server_argv0);
-        perror(buf);
+        perror(buf); /* o.k. since MM sets errno */
         apr_shm_destroy(scoreboard_shm);
         exit(APEXIT_INIT);
     }
index 85b327e980b1ade1041526911ad90a1683e772ea..af40c85b1b42afa38a031c5c8bfea529c917e68e 100644 (file)
@@ -337,27 +337,31 @@ static apr_status_t cleanup_shared_mem(void *d)
 static void setup_shared_mem(apr_pool_t *p)
 {
     char buf[512];
+    char errmsg[120];
     const char *fname;
+    apr_status_t rv;
 
     fname = ap_server_root_relative(p, ap_scoreboard_fname);
-    if (apr_shm_init(&scoreboard_shm, SCOREBOARD_SIZE, fname, p) != APR_SUCCESS) {
-       apr_snprintf(buf, sizeof(buf), "%s: could not open(create) scoreboard",
-                   ap_server_argv0);
-       perror(buf);
+    rv = apr_shm_init(&scoreboard_shm, SCOREBOARD_SIZE, fname, p);
+    if (rv != APR_SUCCESS) {
+       apr_snprintf(buf, sizeof(buf), "%s: could not open(create) scoreboard: %s",
+                   ap_server_argv0, apr_strerror(rv, errmsg, sizeof errmsg));
+       fprintf(stderr, "%s\n", buf);
        exit(APEXIT_INIT);
     }
     ap_scoreboard_image = apr_shm_malloc(scoreboard_shm, SCOREBOARD_SIZE); 
-    if (apr_shm_init(&status_shm, NEW_SCOREBOARD_SIZE, fname, p) != APR_SUCCESS) {
-       apr_snprintf(buf, sizeof(buf), "%s: could not open(create) scoreboard",
-                   ap_server_argv0);
-       perror(buf);
+    rv = apr_shm_init(&status_shm, NEW_SCOREBOARD_SIZE, fname, p);
+    if (rv != APR_SUCCESS) {
+       apr_snprintf(buf, sizeof(buf), "%s: could not open(create) scoreboard: %s",
+                   ap_server_argv0, apr_strerror(rv, errmsg, sizeof errmsg));
+       fprintf(stderr, "%s\n", buf);
        exit(APEXIT_INIT);
     }
     ap_new_scoreboard_image = apr_shm_malloc(status_shm, NEW_SCOREBOARD_SIZE); 
     if (ap_scoreboard_image == NULL || ap_new_scoreboard_image == NULL) {
        apr_snprintf(buf, sizeof(buf), "%s: cannot allocate scoreboard",
                    ap_server_argv0);
-       perror(buf);
+       perror(buf); /* o.k. since MM sets errno */
         apr_shm_destroy(scoreboard_shm);
         apr_shm_destroy(status_shm);
         exit(APEXIT_INIT);