ports/95766: [PATCH] comms/lirc: portlint(1) fixes

Alexander Botero-Lowry alex at foxybanana.com
Sat Apr 15 01:08:54 UTC 2006


Edwin Groothuis <edwin at FreeBSD.org> wrote:

> Synopsis: [PATCH] comms/lirc: portlint(1) fixes
>
> State-Changed-From-To: open->feedback
> State-Changed-By: edwin
> State-Changed-When: Fri Apr 14 22:52:08 UTC 2006
> State-Changed-Why: 
> Awaiting maintainers feedback
>
> http://www.freebsd.org/cgi/query-pr.cgi?pr=95766
>
> !DSPAM:4,4440279a220991255511920!
>
-------------- next part --------------
===> 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


More information about the freebsd-ports-bugs mailing list