]> arthur.barton.de Git - netatalk.git/blobdiff - libatalk/dsi/dsi_getsess.c
Cleanup header checks in configure.in
[netatalk.git] / libatalk / dsi / dsi_getsess.c
index 2ad64b439200e0eace53c66c62342ee9b3478a25..fc2f06def28a4441b49f624bc1e33ea234283323 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: dsi_getsess.c,v 1.6 2002-01-04 04:45:48 sibaz Exp $
+ * $Id: dsi_getsess.c,v 1.7 2005-04-28 20:50:02 bfernhomberg Exp $
  *
  * Copyright (c) 1997 Adrian Sun (asun@zoology.washington.edu)
  * All rights reserved. See COPYRIGHT.
 #include <stdlib.h>
 #include <string.h>
 #include <errno.h>
-#ifdef HAVE_UNISTD_H
 #include <unistd.h>
-#endif /* HAVE_UNISTD_H */
 #include <signal.h>
 
-/* POSIX.1 sys/wait.h check */
 #include <sys/types.h>
-#ifdef HAVE_SYS_WAIT_H
 #include <sys/wait.h>
-#endif /* HAVE_SYS_WAIT_H */
-#ifndef WEXITSTATUS
-#define WEXITSTATUS(stat_val) ((unsigned)(stat_val) >> 8)
-#endif /* ! WEXITSTATUS */
-#ifndef WIFEXITED
-#define WIFEXITED(stat_val) (((stat_val) & 255) == 0)
-#endif /* ! WIFEXITED */
-
 #include <sys/time.h>
 #include <atalk/logger.h>
+#include <atalk/util.h>
 
 #include <atalk/dsi.h>
 #include <atalk/server_child.h>
@@ -60,7 +49,7 @@ DSI *dsi_getsession(DSI *dsi, server_child *serv_children,
   switch (pid = dsi->proto_open(dsi)) {
   case -1:
     /* if we fail, just return. it might work later */
-    LOG(log_error, logtype_default, "dsi_getsess: %s", strerror(errno));
+    LOG(log_error, logtype_dsi, "dsi_getsess: %s", strerror(errno));
     return dsi;
 
   case 0: /* child. mostly handled below. */
@@ -71,7 +60,7 @@ DSI *dsi_getsession(DSI *dsi, server_child *serv_children,
     /* using SIGQUIT is hokey, but the child might not have
      * re-established its signal handler for SIGTERM yet. */
     if (server_child_add(children, CHILD_DSIFORK, pid) < 0) {
-      LOG(log_error, logtype_default, "dsi_getsess: %s", strerror(errno));
+      LOG(log_error, logtype_dsi, "dsi_getsess: %s", strerror(errno));
       dsi->header.dsi_flags = DSIFL_REPLY;
       dsi->header.dsi_code = DSIERR_SERVBUSY;
       dsi_send(dsi);
@@ -87,11 +76,11 @@ DSI *dsi_getsession(DSI *dsi, server_child *serv_children,
    * actual count. */
   if ((children->count >= children->nsessions) &&
       (dsi->header.dsi_command == DSIFUNC_OPEN)) {
-    LOG(log_info, logtype_default, "dsi_getsess: too many connections");
+    LOG(log_info, logtype_dsi, "dsi_getsess: too many connections");
     dsi->header.dsi_flags = DSIFL_REPLY;
     dsi->header.dsi_code = DSIERR_TOOMANY;
     dsi_send(dsi);
-    exit(1);
+    exit(EXITERR_CLNT);
   }
 
   /* get rid of some stuff */
@@ -132,8 +121,8 @@ DSI *dsi_getsession(DSI *dsi, server_child *serv_children,
     break;
 
   default: /* just close */
-    LOG(log_info, logtype_default, "DSIUnknown %d", dsi->header.dsi_command);
+    LOG(log_info, logtype_dsi, "DSIUnknown %d", dsi->header.dsi_command);
     dsi->proto_close(dsi);
-    exit(1);
+    exit(EXITERR_CLNT);
   }
 }