Debianization.
[become] / src / daemon.c
index 3d29735..20698ec 100644 (file)
@@ -1,6 +1,6 @@
 /* -*-c-*-
  *
- * $Id: daemon.c,v 1.15 2003/10/26 11:57:46 mdw Exp $
+ * $Id: daemon.c,v 1.16 2003/11/29 23:39:16 mdw Exp $
  *
  * Running a `become' daemon
  *
@@ -29,6 +29,9 @@
 /*----- Revision history --------------------------------------------------*
  *
  * $Log: daemon.c,v $
+ * Revision 1.16  2003/11/29 23:39:16  mdw
+ * Debianization.
+ *
  * Revision 1.15  2003/10/26 11:57:46  mdw
  * Fix key reloading core dumps.  Change advice on keys.
  *
 /*----- Static variables --------------------------------------------------*/
 
 static int daemon__port = -1;          /* No particular port yet */
-static fwatch daemon__cwatch, daemon__kwatch; /* Watching key / config files */
+static fwatch daemon__cwatch, daemon__kwatch; /* Watching key/config files */
 static sel_timer daemon__timer;                /* Timer for reading */
 static sel_state daemon__sel;          /* Select context */
 static sel_file daemon__listen;                /* Listening socket selector */
@@ -537,9 +540,10 @@ void daemon_init(const char *cf, int port, unsigned f)
 
   if (daemon__port == 0) {
     struct servent *se = getservbyname(quis(), "udp");
-    if (!se)
-      die(1, "no idea which port to listen to");
-    daemon__port = se->s_port;
+    if (se)
+      daemon__port = se->s_port;
+    else
+      daemon__port = htons(SERVER_PORT);
   }
 
   /* --- Now set up a socket --- */