Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 11 Feb 2009 10:48:02 -0600 (CST)
From:      Paul Schmehl <pauls@utdallas.edu>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   ports/131591: add a patch to fix a problem with the pid file
Message-ID:  <20090211164802.2C01E347821@utd65257.utdallas.edu>
Resent-Message-ID: <200902111710.n1BHA71M034765@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         131591
>Category:       ports
>Synopsis:       add a patch to fix a problem with the pid file
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          update
>Submitter-Id:   current-users
>Arrival-Date:   Wed Feb 11 17:10:06 UTC 2009
>Closed-Date:
>Last-Modified:
>Originator:     Paul Schmehl
>Release:        FreeBSD 7.0-STABLE i386
>Organization:
The University of Texas at Dallas
>Environment:
System: FreeBSD hostname.utdallas.edu 7.0-STABLE FreeBSD 7.0-STABLE #9: Mon Jul 14 10:01:23 CDT 2008 root@utd65257.utdallas.edu:/usr/obj/usr/src/sys/GENERIC i386


	
>Description:
	This PR adds a patch to the util.c file to fix a problem with
	the pid file.  It also bumps PORTREVISION.  This software is
	no longer maintained but is still available, and the patch was
	requested by users.  Maintainer can remain ports@FreeBSD.org.
>How-To-Repeat:
	
>Fix:

	

--- patch-Makefile begins here ---
--- Makefile.orig	2009-02-10 21:32:18.000000000 -0600
+++ Makefile	2009-02-10 21:32:34.000000000 -0600
@@ -7,6 +7,7 @@
 
 PORTNAME=	pads
 PORTVERSION=	1.2
+PORTREVISION=	1
 CATEGORIES=	net-mgmt
 MASTER_SITES=	${MASTER_SITE_SOURCEFORGE}
 MASTER_SITE_SUBDIR=	passive
--- patch-Makefile ends here ---

--- patch-util.c begins here ---
--- src/util.orig.c	2009-02-11 10:29:24.000000000 -0500
+++ src/util.c	2009-02-11 10:30:36.000000000 -0500
@@ -117,16 +117,18 @@
     struct passwd *this_user;
 
     /* Default PID File */
-    if (gc.pid_file->slen >= 0)
-        gc.pid_file = bfromcstr("/var/run/pads.pid");
+    if (pid_file == NULL) {
+        pid_file = bfromcstr("/var/run/pads.pid");
+        gc.pid_file = bfromcstr("/var/run/pads.pid"); // Needed to unlink
+    }
 
     /* Create PID File */
-    if ((fp = fopen(bdata(gc.pid_file), "w")) != NULL) {
+    if ((fp = fopen(bdata(pid_file), "w")) != NULL) {
         pid = (int) getpid();
         fprintf(fp, "%d\n", pid);
         fclose(fp);
     } else {
-        err_message("Unable to create PID file (%s).\n", bdata(gc.pid_file));
+        err_message("Unable to create PID file (%s).\n", bdata(pid_file));
     }
 
     /* Change PID File's Ownership */
@@ -137,7 +139,7 @@
         err_message("'%s' group does not appear to exist.", bdata(group));
     if ((this_user = getpwnam(bdata(user))) == NULL)
         err_message("'%s' user does not appear to exist.", bdata(user));
-    if ((chown(pid_file, this_user->pw_uid, this_group->gr_gid)) != 0)
+    if ((chown(bdata(pid_file), this_user->pw_uid, this_group->gr_gid)) != 0)
         err_message("Unable to change PID file's ownership.");
 
 }
--- patch-util.c ends here ---


>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20090211164802.2C01E347821>