duplicated code

Jeremy Allison jra at samba.org
Fri Jul 13 16:08:50 MDT 2012

On Tue, Jul 10, 2012 at 04:10:17PM -0700, Herb Lewis wrote:
> In the file lib/pidfile.c (in both source 3 and source4) the
> functions pidfile_create and
> pidfile_pid (which is called by pidfile_create duplicate code that
> begins with the comments
>         /* Add a suffix to the program name if this is a process with a
>          * none default configuration file name. */

So I think the best way to fix this is to move both functions
into a toplevel lib/pidfile.c and include both versions, called

Then merge the implementations so we end up with one. As the
s3 version does a little more, pidfile_create_s3() might end
up as a wrapper function around pidfile_create().

Sound like a plan ?

> There is also a comment at the beginning of the files that states
> /* this code is broken - there is a race condition with the unlink
> (tridge) */
> Has anyone looked at this race condition?

No, but I will after I've done the merge.


More information about the samba-technical mailing list