lockfile-create --use-pid uses wrong pid

Bug #676723 reported by Larry Diegel
18
This bug affects 3 people
Affects Status Importance Assigned to Milestone
lockfile-progs (Debian)
Fix Released
Unknown
lockfile-progs (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

Binary package hint: lockfile-progs

It uses L_PID which puts the PID of the lockfile-create process in the lock.
It needs to use the L_PPID (2 places) to put the process id of the process
executing lockfile-create.

diff -c lockfile-progs.c_ORIGINAL lockfile-progs.c
*** lockfile-progs.c_ORIGINAL 2010-06-08 22:27:30.000000000 -0700
--- lockfile-progs.c 2010-11-17 13:58:11.093167970 -0800
***************
*** 328,334 ****
  static int
  cmd_lock(const char *lockfilename, int retry_count)
  {
! int rc = lockfile_create(lockfilename, retry_count, (use_pid ? L_PID : 0));
    const char *rc_str = get_status_code_string(rc);

    if(rc != L_SUCCESS)
--- 328,334 ----
  static int
  cmd_lock(const char *lockfilename, int retry_count)
  {
! int rc = lockfile_create(lockfilename, retry_count, (use_pid ? L_PPID : 0));
    const char *rc_str = get_status_code_string(rc);

    if(rc != L_SUCCESS)
***************
*** 363,369 ****
  static int
  cmd_check(const char *lockfilename)
  {
! int rc = lockfile_check(lockfilename, (use_pid ? L_PID : 0));
    return rc;
  }

--- 363,369 ----
  static int
  cmd_check(const char *lockfilename)
  {
! int rc = lockfile_check(lockfilename, (use_pid ? L_PPID : 0));
    return rc;
  }

ProblemType: Bug
DistroRelease: Ubuntu 10.10
Package: lockfile-progs 0.1.15
ProcVersionSignature: Ubuntu 2.6.35-22.35-generic 2.6.35.4
Uname: Linux 2.6.35-22-generic x86_64
NonfreeKernelModules: nvidia
Architecture: amd64
Date: Wed Nov 17 14:10:46 2010
InstallationMedia: Ubuntu 10.10 "Maverick Meerkat" - Release amd64 (20101007.1)
ProcEnviron:
 PATH=(custom, user)
 LANG=en_US.utf8
 SHELL=/usr/local/bin/bash
SourcePackage: lockfile-progs

Revision history for this message
Larry Diegel (diegella) wrote :
Revision history for this message
Matthias Urlichs (smurf) wrote :

Definitely. Without this change lockfile-create is useless, as it succeeds every time.

Changed in lockfile-progs (Ubuntu):
status: New → Confirmed
Changed in lockfile-progs (Debian):
status: Unknown → New
Changed in lockfile-progs (Debian):
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.