Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 15 Apr 2006 03:20:20 GMT
From:      Alexander Botero-Lowry <alex@foxybanana.com>
To:        freebsd-ports-bugs@FreeBSD.org
Subject:   Re: ports/95766: [PATCH] comms/lirc: portlint(1) fixes
Message-ID:  <200604150320.k3F3KKsJ007638@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
The following reply was made to PR ports/95766; it has been noted by GNATS.

From: Alexander Botero-Lowry <alex@foxybanana.com>
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: ports/95766: [PATCH] comms/lirc: portlint(1) fixes
Date: Fri, 14 Apr 2006 20:18:05 -0700

 This is a multi-part message in MIME format.
 
 --=_444065ed.A/gaceH+ZVCE6w0FvbqqlnlmQbkoNWEpSfivAjjGF6ikDcuq
 Content-Type: text/plain; charset=us-ascii
 Content-Transfer-Encoding: 7bit
 Content-Disposition: inline
 
 Attached is the actual patch - sorry about that.
 
 
 --=_444065ed.A/gaceH+ZVCE6w0FvbqqlnlmQbkoNWEpSfivAjjGF6ikDcuq
 Content-Type: text/plain;
  charset=us-ascii
 Content-Transfer-Encoding: 7bit
 Content-Disposition: attachment;
  filename="lirc.patch"
 
 ===> Generating patch
 ===> Viewing diff with more
 diff -ruN --exclude=CVS /usr/ports/comms/lirc/Makefile /usr/local/tinderbox/portstrees/FreeBSD/ports/comms/lirc/Makefile
 --- /usr/ports/comms/lirc/Makefile	Thu Feb 23 02:34:58 2006
 +++ /usr/local/tinderbox/portstrees/FreeBSD/ports/comms/lirc/Makefile	Fri Apr 14 18:04:48 2006
 @@ -18,7 +18,7 @@
  USE_GETOPT_LONG=yes
  USE_GMAKE=	yes
  GNU_CONFIGURE=	yes
 -USE_REINPLACE=	yes
 +INSTALLS_SHLIB=	yes
  
  CONFIGURE_TARGET=	--build=${MACHINE_ARCH}-portbld-freebsd${OSREL}
  CONFIGURE_ARGS=		--disable-manage-devices --with-devdir=/var/lirc
 diff -ruN --exclude=CVS /usr/ports/comms/lirc/files/patch-daemons::serial.c /usr/local/tinderbox/portstrees/FreeBSD/ports/comms/lirc/files/patch-daemons::serial.c
 --- /usr/ports/comms/lirc/files/patch-daemons::serial.c	Tue Oct 18 20:41:51 2005
 +++ /usr/local/tinderbox/portstrees/FreeBSD/ports/comms/lirc/files/patch-daemons::serial.c	Wed Dec 31 16:00:00 1969
 @@ -1,94 +0,0 @@
 ---- daemons/serial.c.orig	Mon Mar  7 20:03:48 2005
 -+++ daemons/serial.c	Sun Aug 21 21:44:26 2005
 -@@ -29,6 +29,10 @@
 - 
 - #include "lircd.h"
 - 
 -+#define LOCKDIR "/var/spool/lock"
 -+
 -+static char *lockpath = NULL;
 -+
 - int tty_reset(int fd)
 - {
 - 	struct termios options;
 -@@ -183,7 +187,7 @@
 - 	int lock;
 - 	int len;
 - 	
 --	strcpy(filename,"/var/lock/LCK..");
 -+	strcpy(filename,LOCKDIR "/LCK..");
 - 	
 - 	last=strrchr(name,'/');
 - 	if(last!=NULL)
 -@@ -373,63 +377,22 @@
 - 			}
 - 		}
 - 	}
 -+	lockpath = strdup(filename);
 - 	return(1);
 - }
 - 
 - int tty_delete_lock(void)
 - {
 --	DIR *dp;
 --	struct dirent *ep;
 --	int lock;
 --	int len;
 --	char id[20+1],*endptr;
 --	char filename[FILENAME_MAX+1];
 --	long pid;
 --	int retval=1;
 --	
 --	dp=opendir("/var/lock/");
 --	if(dp!=NULL)
 --	{
 --		while((ep=readdir(dp)))
 --		{
 --			strcpy(filename,"/var/lock/");
 --			if(strlen(filename)+strlen(ep->d_name)>FILENAME_MAX) 
 --			{retval=0;continue;}
 --			strcat(filename,ep->d_name);
 --			lock=open(filename,O_RDONLY);
 --			if(lock==-1) {retval=0;continue;}
 --			len=read(lock,id,20);
 --			close(lock);
 --			if(len<=0) {retval=0;continue;}
 --			id[len]=0;
 --			pid=strtol(id,&endptr,10);
 --			if(!*id || *endptr!='\n')
 --			{
 --				logprintf(LOG_WARNING,"invalid lockfile (%s) "
 --					  "detected",filename);
 --				retval=0;
 --				continue;
 --			}
 --			if(pid==getpid())
 --			{
 --				if(unlink(filename)==-1)
 --				{
 --					logprintf(LOG_ERR,"could not delete "
 --						  "file \"%s\"",filename);
 --					logperror(LOG_ERR,NULL);
 --					retval=0;
 --					continue;
 --				}
 --			}
 --		}
 --		closedir(dp);
 --	}
 --	else
 -+	if(unlink(lockpath)==-1)
 - 	{
 --		logprintf(LOG_ERR,"could not open directory \"/var/lock/\"");
 -+		logprintf(LOG_ERR,"could not delete "
 -+					 "file \"%s\"",lockpath);
 -+		logperror(LOG_ERR,NULL);
 -+		free(lockpath);
 - 		return(0);
 - 	}
 --	return(retval);
 -+	free(lockpath);
 -+	return(1);
 - }
 - 
 - int tty_set(int fd,int rts,int dtr)
 diff -ruN --exclude=CVS /usr/ports/comms/lirc/files/patch-daemons_serial.c /usr/local/tinderbox/portstrees/FreeBSD/ports/comms/lirc/files/patch-daemons_serial.c
 --- /usr/ports/comms/lirc/files/patch-daemons_serial.c	Wed Dec 31 16:00:00 1969
 +++ /usr/local/tinderbox/portstrees/FreeBSD/ports/comms/lirc/files/patch-daemons_serial.c	Tue Oct 18 20:41:51 2005
 @@ -0,0 +1,94 @@
 +--- daemons/serial.c.orig	Mon Mar  7 20:03:48 2005
 ++++ daemons/serial.c	Sun Aug 21 21:44:26 2005
 +@@ -29,6 +29,10 @@
 + 
 + #include "lircd.h"
 + 
 ++#define LOCKDIR "/var/spool/lock"
 ++
 ++static char *lockpath = NULL;
 ++
 + int tty_reset(int fd)
 + {
 + 	struct termios options;
 +@@ -183,7 +187,7 @@
 + 	int lock;
 + 	int len;
 + 	
 +-	strcpy(filename,"/var/lock/LCK..");
 ++	strcpy(filename,LOCKDIR "/LCK..");
 + 	
 + 	last=strrchr(name,'/');
 + 	if(last!=NULL)
 +@@ -373,63 +377,22 @@
 + 			}
 + 		}
 + 	}
 ++	lockpath = strdup(filename);
 + 	return(1);
 + }
 + 
 + int tty_delete_lock(void)
 + {
 +-	DIR *dp;
 +-	struct dirent *ep;
 +-	int lock;
 +-	int len;
 +-	char id[20+1],*endptr;
 +-	char filename[FILENAME_MAX+1];
 +-	long pid;
 +-	int retval=1;
 +-	
 +-	dp=opendir("/var/lock/");
 +-	if(dp!=NULL)
 +-	{
 +-		while((ep=readdir(dp)))
 +-		{
 +-			strcpy(filename,"/var/lock/");
 +-			if(strlen(filename)+strlen(ep->d_name)>FILENAME_MAX) 
 +-			{retval=0;continue;}
 +-			strcat(filename,ep->d_name);
 +-			lock=open(filename,O_RDONLY);
 +-			if(lock==-1) {retval=0;continue;}
 +-			len=read(lock,id,20);
 +-			close(lock);
 +-			if(len<=0) {retval=0;continue;}
 +-			id[len]=0;
 +-			pid=strtol(id,&endptr,10);
 +-			if(!*id || *endptr!='\n')
 +-			{
 +-				logprintf(LOG_WARNING,"invalid lockfile (%s) "
 +-					  "detected",filename);
 +-				retval=0;
 +-				continue;
 +-			}
 +-			if(pid==getpid())
 +-			{
 +-				if(unlink(filename)==-1)
 +-				{
 +-					logprintf(LOG_ERR,"could not delete "
 +-						  "file \"%s\"",filename);
 +-					logperror(LOG_ERR,NULL);
 +-					retval=0;
 +-					continue;
 +-				}
 +-			}
 +-		}
 +-		closedir(dp);
 +-	}
 +-	else
 ++	if(unlink(lockpath)==-1)
 + 	{
 +-		logprintf(LOG_ERR,"could not open directory \"/var/lock/\"");
 ++		logprintf(LOG_ERR,"could not delete "
 ++					 "file \"%s\"",lockpath);
 ++		logperror(LOG_ERR,NULL);
 ++		free(lockpath);
 + 		return(0);
 + 	}
 +-	return(retval);
 ++	free(lockpath);
 ++	return(1);
 + }
 + 
 + int tty_set(int fd,int rts,int dtr)
 diff -ruN --exclude=CVS /usr/ports/comms/lirc/files/patch-drivers::lirc.h /usr/local/tinderbox/portstrees/FreeBSD/ports/comms/lirc/files/patch-drivers::lirc.h
 --- /usr/ports/comms/lirc/files/patch-drivers::lirc.h	Tue Oct 18 20:41:51 2005
 +++ /usr/local/tinderbox/portstrees/FreeBSD/ports/comms/lirc/files/patch-drivers::lirc.h	Wed Dec 31 16:00:00 1969
 @@ -1,10 +0,0 @@
 ---- drivers/lirc.h.orig	Sun Aug 21 21:45:04 2005
 -+++ drivers/lirc.h	Sun Aug 21 21:45:11 2005
 -@@ -8,6 +8,7 @@
 - #include <linux/ioctl.h>
 - #else
 - #include <sys/types.h>
 -+#include <sys/ioctl.h>
 - typedef u_int32_t __u32;
 - #endif
 - 
 diff -ruN --exclude=CVS /usr/ports/comms/lirc/files/patch-drivers_lirc.h /usr/local/tinderbox/portstrees/FreeBSD/ports/comms/lirc/files/patch-drivers_lirc.h
 --- /usr/ports/comms/lirc/files/patch-drivers_lirc.h	Wed Dec 31 16:00:00 1969
 +++ /usr/local/tinderbox/portstrees/FreeBSD/ports/comms/lirc/files/patch-drivers_lirc.h	Tue Oct 18 20:41:51 2005
 @@ -0,0 +1,10 @@
 +--- drivers/lirc.h.orig	Sun Aug 21 21:45:04 2005
 ++++ drivers/lirc.h	Sun Aug 21 21:45:11 2005
 +@@ -8,6 +8,7 @@
 + #include <linux/ioctl.h>
 + #else
 + #include <sys/types.h>
 ++#include <sys/ioctl.h>
 + typedef u_int32_t __u32;
 + #endif
 + 
 ===> Done
 
 --=_444065ed.A/gaceH+ZVCE6w0FvbqqlnlmQbkoNWEpSfivAjjGF6ikDcuq--



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