On Wednesday 06 September 2006 11:27, Ask Bjørn Hansen wrote:
> > config_dir attempts to get the config from $name/config, $name  
> > being based on
> > $0, but $0 (the process name) is changed in qpsmtpd-prefork for  
> > prettyness.
>
> It should just store the name somewhere else before messing with $0.  
> The pretty names are useful for debugging with "ps axw" when you see  
> a hundred qpsmtpd processes running.

No arguement there, pretty is pretty :)
Attached patch does save $0 before changing it, and doesn't affect forkserver 
operation.

-- 
Mike Williams
System Administration Manager - Comodo
Office Tel Europe: +44 (0) 161 8747070
Fax Europe: +44 (0) 161 8771767
Index: qpsmtpd-prefork
===================================================================
--- qpsmtpd-prefork	(revision 658)
+++ qpsmtpd-prefork	(working copy)
@@ -336,6 +336,7 @@
     # continue to accept connections until "old age" is reached
     for (my $i = 0 ; $i < $child_lifetime ; $i++) {
         # accept a connection
+        $ENV{PROCESS} = $0;
         $0 = 'qpsmtpd child';    # set pretty child name in process listing
         my ($client, $iinfo) = $d->accept()
           or die
Index: lib/Qpsmtpd.pm
===================================================================
--- lib/Qpsmtpd.pm	(revision 658)
+++ lib/Qpsmtpd.pm	(working copy)
@@ -112,7 +112,7 @@
 sub config_dir {
   my ($self, $config) = @_;
   my $configdir = ($ENV{QMAIL} || '/var/qmail') . '/control';
-  my ($name) = ($0 =~ m!(.*?)/([^/]+)$!);
+  my ($name) = ($ENV{PROCESS}) ? ($ENV{PROCESS} =~ m!(.*?)/([^/]+)$!) : ($0 =~ m!(.*?)/([^/]+)$!);
   $configdir = "$name/config" if (-e "$name/config/$config");
   if (exists $ENV{QPSMTPD_CONFIG}) {
     $ENV{QPSMTPD_CONFIG} =~ /^(.*)$/; # detaint

Reply via email to