From: deraadt Date: Mon, 26 Oct 2015 09:58:18 +0000 (+0000) Subject: Stop writing a pidfile X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=ceaf4be1ea9fffc212e2e083d4a3da9c89ea4cf4;p=openbsd Stop writing a pidfile ok benno jung --- diff --git a/usr.sbin/wsmoused/wsmoused.8 b/usr.sbin/wsmoused/wsmoused.8 index ec30b27712a..770e332c03f 100644 --- a/usr.sbin/wsmoused/wsmoused.8 +++ b/usr.sbin/wsmoused/wsmoused.8 @@ -1,4 +1,4 @@ -.\" $OpenBSD: wsmoused.8,v 1.19 2013/07/16 11:13:34 schwarze Exp $ +.\" $OpenBSD: wsmoused.8,v 1.20 2015/10/26 09:58:18 deraadt Exp $ .\" .\" Copyright (c) 2001 Jean-Baptiste Marchand .\" All rights reserved. @@ -24,7 +24,7 @@ .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" -.Dd $Mdocdate: July 16 2013 $ +.Dd $Mdocdate: October 26 2015 $ .Dt WSMOUSED 8 i386 .Os .Sh NAME @@ -35,7 +35,6 @@ .Op Fl 2dfi .Op Fl C Ar thresh .Op Fl D Ar device -.Op Fl I Ar file .Oo .Fl M .Ar N Ns = Ns Ar M @@ -87,11 +86,6 @@ Enable debugging messages. .It Fl f Do not become a daemon and instead run as a foreground process. Useful for testing and debugging. -.It Fl I Ar file -Write the process ID of -.Nm -to the specified -.Ar file . .It Fl i Print the type and the protocol of the mouse and exit. .It Fl M Ar N Ns = Ns Ar M diff --git a/usr.sbin/wsmoused/wsmoused.c b/usr.sbin/wsmoused/wsmoused.c index 8393bafeb7f..8e0c849901f 100644 --- a/usr.sbin/wsmoused/wsmoused.c +++ b/usr.sbin/wsmoused/wsmoused.c @@ -1,4 +1,4 @@ -/* $OpenBSD: wsmoused.c,v 1.35 2014/12/23 10:24:22 shadchin Exp $ */ +/* $OpenBSD: wsmoused.c,v 1.36 2015/10/26 09:58:18 deraadt Exp $ */ /* * Copyright (c) 2001 Jean-Baptiste Marchand, Julien Montagne and Jerome Verdon @@ -73,7 +73,6 @@ #include "wsmoused.h" #define DEFAULT_TTY "/dev/ttyCcfg" -#define DEFAULT_PIDFILE "/var/run/wsmoused.pid" extern char *__progname; extern char *mouse_names[]; @@ -82,7 +81,6 @@ int debug = 0; int background = FALSE; int nodaemon = FALSE; int identify = FALSE; -char *pidfile = NULL; mouse_t mouse = { .flags = 0, @@ -233,8 +231,6 @@ terminate(int sig) close(mouse.mfd); mouse.mfd = -1; } - if (pidfile != NULL) - unlink(pidfile); _exit(0); } @@ -433,7 +429,7 @@ wsmoused(void) static void usage(void) { - fprintf(stderr, "usage: %s [-2dfi] [-C thresh] [-D device] [-I file]" + fprintf(stderr, "usage: %s [-2dfi] [-C thresh] [-D device]" " [-M N=M]\n\t[-p device] [-t type]\n", __progname); exit(1); } @@ -441,12 +437,11 @@ usage(void) int main(int argc, char **argv) { - FILE *fp; unsigned int type; int opt; int i; -#define GETOPT_STRING "2dfhip:t:C:D:I:M:" +#define GETOPT_STRING "2dfhip:t:C:D:M:" while ((opt = (getopt(argc, argv, GETOPT_STRING))) != -1) { switch (opt) { case '2': @@ -501,9 +496,6 @@ main(int argc, char **argv) if ((mouse.ttyname = strdup(optarg)) == NULL) logerr(1, "out of memory"); break; - case 'I': - pidfile = optarg; - break; case 'M': if (!mouse_installmap(optarg)) { warnx("invalid mapping `%s'", optarg); @@ -570,13 +562,6 @@ main(int argc, char **argv) logerr(1, "failed to become a daemon"); } else { background = TRUE; - if (pidfile != NULL) { - fp = fopen(pidfile, "w"); - if (fp != NULL) { - fprintf(fp, "%ld\n", (long)getpid()); - fclose(fp); - } - } } } diff --git a/usr.sbin/wsmoused/wsmoused.h b/usr.sbin/wsmoused/wsmoused.h index 6391178b91c..cf935882662 100644 --- a/usr.sbin/wsmoused/wsmoused.h +++ b/usr.sbin/wsmoused/wsmoused.h @@ -1,4 +1,4 @@ -/* $OpenBSD: wsmoused.h,v 1.11 2014/05/14 18:23:22 shadchin Exp $ */ +/* $OpenBSD: wsmoused.h,v 1.12 2015/10/26 09:58:18 deraadt Exp $ */ /* * Copyright (c) 2001 Jean-Baptiste Marchand, Julien Montagne and Jerome Verdon @@ -55,15 +55,11 @@ /* Logging macros */ -extern char *pidfile; - #define debug(fmt, ...) \ if (debug&&nodaemon) printf(fmt, __VA_ARGS__) #define logerr(e, ...) \ do { \ - if (pidfile != NULL) \ - unlink(pidfile); \ if (background) { \ syslog(LOG_ERR, __VA_ARGS__); \ exit(e); \