Bug 4862 - pid file name off by one?
Summary: pid file name off by one?
Status: RESOLVED FIXED
Alias: None
Product: Samba 3.0
Classification: Unclassified
Component: libsmbclient (show other bugs)
Version: 3.0.25b
Hardware: x86 Linux
: P3 normal
Target Milestone: none
Assignee: Derrell Lipman
QA Contact: Samba QA Contact
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-08-07 04:37 UTC by Chris Ritson
Modified: 2007-08-07 04:43 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Ritson 2007-08-07 04:37:47 UTC
I have noticed for a while that an instance of samba with a non-standard config file name does not close down cleanly as the PID file cannot be found. I initially thought this was my own start stop script but on careful checking it looks to be in lib/pidfile.c

[sn]mbd are started with arguments: -s /addon/local/samba/conf/smb.conf.vs-web-cs3

The Pid file directory is set in this config file with:-
    pid directory = /addon/local/var/samba/locks

The Pid files I saw created were:-
    /addon/local/var/samba/locks/[sn]mbd-mb.conf.vs-web-cs3.pid
(note no s in the smb that is supposed to come from the config file name.

Suggested patch:-

*** lib/pidfile.c-      2007-04-09 18:30:57.000000000 +0100
--- lib/pidfile.c       2007-08-07 10:05:19.000000000 +0100
***************
*** 100,106 ****
                        /* full/relative path provided */
                        short_configfile++;
                }
!               slprintf( name, sizeof( name)-1, "%s-%s", program_name, short_configfile+1);
        }
  
        slprintf(pidFile, sizeof(pidFile)-1, "%s/%s.pid", lp_piddir(), name);
--- 100,106 ----
                        /* full/relative path provided */
                        short_configfile++;
                }
!               slprintf( name, sizeof( name)-1, "%s-%s", program_name, short_configfile);
        }
  
        slprintf(pidFile, sizeof(pidFile)-1, "%s/%s.pid", lp_piddir(), name);


I have also seen bug 4770 which is more of an enhancement than a bug fix but could well be folded in here (it might also fix this minor fault, I haven't checked).

Chris Ritson.
Comment 1 Volker Lendecke 2007-08-07 04:43:01 UTC
Already fixed with r24008. Will be in 3.0.25c.

Thanks,

Volker