OSSP CVS Repository

ossp - Difference in ossp-pkg/petidomo/main.c versions 1.9 and 1.10
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [History

ossp-pkg/petidomo/main.c 1.9 -> 1.10

--- main.c       2001/01/18 20:30:50     1.9
+++ main.c       2001/01/19 12:49:44     1.10
@@ -1,6 +1,6 @@
 /*
    $Source: /v/ossp/cvs/ossp-pkg/petidomo/main.c,v $
-   $Revision: 1.9 $
+   $Revision: 1.10 $
 
    Copyright (C) 2000 by CyberSolutions GmbH, Germany.
 
@@ -24,6 +24,7 @@
 #include <string.h>
 
 #include "libargv/argv.h"
+#include "libtext/text.h"
 #include "petidomo.h"
 
 #ifndef LOG_PERROR
@@ -34,6 +35,7 @@
 static char*  mode = NULL;
 static char*  masterconfig_path = SYSCONFDIR "/petidomo.conf";
 char          g_is_approved = ARGV_FALSE;
+const char* who_am_i;
 
 int
 main(int argc, char * argv[])
@@ -54,6 +56,25 @@
 
     openlog("petidomo", LOG_CONS | LOG_PID | LOG_PERROR, LOG_MAIL);
 
+    /* Store our full path and program name in who_am_I, so that
+       queue_posting() and queue_command() know where to find the
+       Petidomo binary. */
+
+    if (argv[0][0] == '/')
+        {
+        who_am_i = argv[0];
+        }
+    else
+        {
+        char buf[4096];
+        if (getcwd(buf, sizeof(buf)) == NULL)
+            {
+            syslog(LOG_CRIT, "Failed to get the path to my current working directory.");
+            exit(1);
+            }
+        who_am_i = text_easy_sprintf("%s/%s", buf, argv[0]);
+        }
+
     /* Parse the command line. */
 
     argv_help_string = "Petidomo Mailing List Server";

CVSTrac 2.0.1