Module Name:    src
Committed By:   snj
Date:           Sun Dec 21 19:27:11 UTC 2014

Modified Files:
        src/usr.sbin/perfused [netbsd-7]: perfused.c

Log Message:
Pull up following revision(s) (requested by manu in ticket #335):
        usr.sbin/perfused/perfused.c: revision 1.25
Survive if filesystem installs a signal handler
We tested for signal(3) to return 0 for success, which is incorrect:
signal(3) returns the previous handler. Success should be tested as
!= SIG_ERR, otherwise we fail when a signal handler was previously
installed by perfused(8) parrent process, which happens to be the
FUSE filesystem.


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.24.10.1 src/usr.sbin/perfused/perfused.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/perfused/perfused.c
diff -u src/usr.sbin/perfused/perfused.c:1.24 src/usr.sbin/perfused/perfused.c:1.24.10.1
--- src/usr.sbin/perfused/perfused.c:1.24	Sat Jul 21 05:49:42 2012
+++ src/usr.sbin/perfused/perfused.c	Sun Dec 21 19:27:11 2014
@@ -1,4 +1,4 @@
-/*  $NetBSD: perfused.c,v 1.24 2012/07/21 05:49:42 manu Exp $ */
+/*  $NetBSD: perfused.c,v 1.24.10.1 2014/12/21 19:27:11 snj Exp $ */
 
 /*-
  *  Copyright (c) 2010 Emmanuel Dreyfus. All rights reserved.
@@ -298,7 +298,7 @@ new_mount(int fd, int pmnt_flags)
 		     "could not open \"%s\"",
 		     _PATH_VAR_RUN_PERFUSE_TRACE);
 
-	if (signal(SIGUSR1, sigusr1_handler) != 0)
+	if (signal(SIGUSR1, sigusr1_handler) == SIG_ERR)
 		DERR(EX_OSERR, "signal failed");
 
 	/*
@@ -399,7 +399,7 @@ parse_options(int argc, char **argv)
 			perfuse_diagflags |= parse_debug(optarg);
 			break;
 		case 's':
-			if (signal(SIGINFO, siginfo_handler) != 0)
+			if (signal(SIGINFO, siginfo_handler) == SIG_ERR)
 				DERR(EX_OSERR, "signal failed");
 			break;
 		case 'f':

Reply via email to