Index: ossp-pkg/petidomo/main.c RCS File: /v/ossp/cvs/ossp-pkg/petidomo/main.c,v rcsdiff -q -kk '-r1.9' '-r1.10' -u '/v/ossp/cvs/ossp-pkg/petidomo/main.c,v' 2>/dev/null --- main.c 2001/01/18 20:30:50 1.9 +++ main.c 2001/01/19 12:49:44 1.10 @@ -24,6 +24,7 @@ #include #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"; Index: ossp-pkg/petidomo/petidomo.h RCS File: /v/ossp/cvs/ossp-pkg/petidomo/petidomo.h,v rcsdiff -q -kk '-r1.16' '-r1.17' -u '/v/ossp/cvs/ossp-pkg/petidomo/petidomo.h,v' 2>/dev/null --- petidomo.h 2001/01/18 20:30:50 1.16 +++ petidomo.h 2001/01/19 12:49:44 1.17 @@ -51,6 +51,7 @@ /********** main.c **********/ extern char g_is_approved; +extern const char* who_am_i; /********** config.c **********/ Index: ossp-pkg/petidomo/queue_command.c RCS File: /v/ossp/cvs/ossp-pkg/petidomo/Attic/queue_command.c,v rcsdiff -q -kk '-r1.3' '-r1.4' -u '/v/ossp/cvs/ossp-pkg/petidomo/Attic/queue_command.c,v' 2>/dev/null --- queue_command.c 2001/01/18 20:30:50 1.3 +++ queue_command.c 2001/01/19 12:49:44 1.4 @@ -39,7 +39,7 @@ } fprintf(fh, "#! /bin/sh\n"); fprintf(fh, "\n"); - fprintf(fh, BINDIR "/petidomo --mode=listserv --approved <<[end-of-mail-marker]\n"); + fprintf(fh, "%s --mode=listserv --approved <<[end-of-mail-marker]\n", who_am_i); fprintf(fh, "Sender: %s\n", mail->Envelope); fprintf(fh, "From: %s\n", mail->From); if (mail->Reply_To) Index: ossp-pkg/petidomo/queue_posting.c RCS File: /v/ossp/cvs/ossp-pkg/petidomo/Attic/queue_posting.c,v rcsdiff -q -kk '-r1.3' '-r1.4' -u '/v/ossp/cvs/ossp-pkg/petidomo/Attic/queue_posting.c,v' 2>/dev/null --- queue_posting.c 2001/01/18 20:30:50 1.3 +++ queue_posting.c 2001/01/19 12:49:44 1.4 @@ -39,7 +39,7 @@ } fprintf(fh, "#! /bin/sh\n"); fprintf(fh, "\n"); - fprintf(fh, BINDIR "/petidomo --mode=deliver --listname=%s --approved <<[end-of-mail-marker]\n", listname); + fprintf(fh, "%s --mode=deliver --listname=%s --approved <<[end-of-mail-marker]\n", who_am_i, listname); fprintf(fh, "%s\n", mail->Header); fprintf(fh, "%s", mail->Body); fprintf(fh, "[end-of-mail-marker]\n");