Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/usbhidaction If running as a demon, make sure config...



details:   https://anonhg.NetBSD.org/src/rev/d9bebdf23b19
branches:  trunk
changeset: 580570:d9bebdf23b19
user:      augustss <augustss%NetBSD.org@localhost>
date:      Fri Apr 29 17:18:30 2005 +0000

description:
If running as a demon, make sure config file has an absolute path name.
Partly addresses PR 15769.

diffstat:

 usr.bin/usbhidaction/usbhidaction.c |  8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diffs (36 lines):

diff -r 7a2e3da6b740 -r d9bebdf23b19 usr.bin/usbhidaction/usbhidaction.c
--- a/usr.bin/usbhidaction/usbhidaction.c       Fri Apr 29 17:02:06 2005 +0000
+++ b/usr.bin/usbhidaction/usbhidaction.c       Fri Apr 29 17:18:30 2005 +0000
@@ -1,4 +1,4 @@
-/*      $NetBSD: usbhidaction.c,v 1.17 2004/11/05 22:43:47 dsl Exp $ */
+/*      $NetBSD: usbhidaction.c,v 1.18 2005/04/29 17:18:30 augustss Exp $ */
 
 /*
  * Copyright (c) 2000, 2002 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
 #include <sys/cdefs.h>
 
 #ifndef lint
-__RCSID("$NetBSD: usbhidaction.c,v 1.17 2004/11/05 22:43:47 dsl Exp $");
+__RCSID("$NetBSD: usbhidaction.c,v 1.18 2005/04/29 17:18:30 augustss Exp $");
 #endif
 
 #include <stdio.h>
@@ -145,6 +145,9 @@
                dev = devnamebuf;
        }
 
+       if (demon && conf[0] != '/')
+               errx(1, "config file must have an absolute path, %s", conf);
+
        fd = open(dev, O_RDWR);
        if (fd < 0)
                err(1, "%s", dev);
@@ -243,7 +246,6 @@
        struct hid_item h;
        int u, lo, hi, range;
        
-
        f = fopen(conf, "r");
        if (f == NULL)
                err(1, "%s", conf);



Home | Main Index | Thread Index | Old Index