request for added feature be commited: duende pid file

Yarin yarin at warpmail.net
Tue Dec 28 13:35:42 EST 2010


Below is a diff patch for ./tools/duende.c as found in your 2.0.01 release of MaraDNS. (labeled as being current on your download page)

I'm releasing it under the same standard two-clause BSD license, sorry about not specifying that.


148a149
>     int exec_argv_offset = 1; /* Also used to determine PID writing */
150c151
<         printf("Usage: duende [program] [arguments]\n");
---
>         printf("Usage: duende (--pid=/path/to/file) [program] [arguments]\n");
152a154,160
>     if(!strncasecmp(argv[1],"--pid=",6)) {
>         if(argv[2] == NULL) {
>             printf("Usage: duende (--pid=/path/to/file) [program] [arguments]\n");
>             exit(1);
>             }
>         exec_argv_offset = 2;
>         }
166a175,186
>     /* Write our PID to a file if the user so desires us to */
>     if(exec_argv_offset == 2) {
>         FILE *fp_pid = fopen(argv[1] + 6,"w");
>         if(!fp_pid) {
>             syslog(LOG_ALERT,"Fatal writing, to PID file, error\n");
>             exit(1);
>             }
>         unsigned int local_pid = getpid();
>         fprintf(fp_pid,"%u",local_pid);
>         fclose(fp_pid);
>         }
> 
196,197c216,217
<             argv[0] = argv[1];
<             execvp(argv[1],argv + 1);
---
>             argv[0] = argv[exec_argv_offset];
>             execvp(argv[exec_argv_offset],argv + exec_argv_offset);
199c219
<             printf("duende: %s: Command can't run, terminating\n",argv[1]);
---
>             printf("duende: %s: Command can't run, terminating\n",argv[exec_argv_offset]);
209c229
<             log_helper(argv[1],stream1[0]);
---
>             log_helper(argv[exec_argv_offset],stream1[0]);


----- Original message -----
From: "Sam Trenholme" <strenholme.usenet at gmail.com>
To: list at maradns.org
Date: Tue, 28 Dec 2010 10:32:11 -0700
Subject: Re: request for added feature be commited: duende pid file

> To fix this, I've added a PID file feature to the duende. I figured, all good daemons have it, why doesn't yours? :-)
> I've successfully compiled and tested the code, and am using it myself, so it's ready to go.

Before I even look at your code, I need to know under what license
you're releasing this code.  I also would like to see this as a patch
against the currently existing Duende instead of a rewrite.

Take care,

- Sam



More information about the list mailing list