[Midnightbsd-cvs] src [10892] trunk/usr.bin/usbhidaction/usbhidaction.c: update
laffer1 at midnightbsd.org
laffer1 at midnightbsd.org
Wed Jun 13 20:18:33 EDT 2018
Revision: 10892
http://svnweb.midnightbsd.org/src/?rev=10892
Author: laffer1
Date: 2018-06-13 20:18:32 -0400 (Wed, 13 Jun 2018)
Log Message:
-----------
update
Modified Paths:
--------------
trunk/usr.bin/usbhidaction/usbhidaction.c
Modified: trunk/usr.bin/usbhidaction/usbhidaction.c
===================================================================
--- trunk/usr.bin/usbhidaction/usbhidaction.c 2018-06-14 00:13:27 UTC (rev 10891)
+++ trunk/usr.bin/usbhidaction/usbhidaction.c 2018-06-14 00:18:32 UTC (rev 10892)
@@ -1,5 +1,6 @@
+/* $MidnightBSD$ */
/* $NetBSD: usbhidaction.c,v 1.8 2002/06/11 06:06:21 itojun Exp $ */
-/* $MidnightBSD$ */
+/* $FreeBSD: stable/10/usr.bin/usbhidaction/usbhidaction.c 289218 2015-10-13 08:21:15Z hselasky $ */
/*
* Copyright (c) 2000, 2002 The NetBSD Foundation, Inc.
@@ -64,7 +65,7 @@
char *name;
char *action;
};
-struct command *commands;
+static struct command *commands;
#define SIZE 4000
@@ -166,17 +167,15 @@
if (demon) {
fp = open(pidfile, O_WRONLY|O_CREAT, S_IRUSR|S_IRGRP|S_IROTH);
- if (fp >= 0) {
- sz1 = snprintf(buf, sizeof buf, "%ld\n",
- (long)getpid());
- if (sz1 > sizeof buf)
- sz1 = sizeof buf;
- write(fp, buf, sz1);
- close(fp);
- } else
+ if (fp < 0)
err(1, "%s", pidfile);
if (daemon(0, 0) < 0)
err(1, "daemon()");
+ snprintf(buf, sizeof(buf), "%ld\n", (long)getpid());
+ sz1 = strlen(buf);
+ if (write(fp, buf, sz1) < 0)
+ err(1, "%s", pidfile);
+ close(fp);
isdemon = 1;
}
More information about the Midnightbsd-cvs
mailing list