Module Name: src Committed By: christos Date: Tue Dec 28 15:28:31 UTC 2010
Modified Files: src/usr.bin/find: find.c main.c Log Message: only setup siginfo handler if we have a tty. To generate a diff of this commit: cvs rdiff -u -r1.26 -r1.27 src/usr.bin/find/find.c cvs rdiff -u -r1.28 -r1.29 src/usr.bin/find/main.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.bin/find/find.c diff -u src/usr.bin/find/find.c:1.26 src/usr.bin/find/find.c:1.27 --- src/usr.bin/find/find.c:1.26 Mon Dec 27 11:09:46 2010 +++ src/usr.bin/find/find.c Tue Dec 28 10:28:31 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: find.c,v 1.26 2010/12/27 16:09:46 christos Exp $ */ +/* $NetBSD: find.c,v 1.27 2010/12/28 15:28:31 christos Exp $ */ /*- * Copyright (c) 1991, 1993, 1994 @@ -37,7 +37,7 @@ #if 0 static char sccsid[] = "from: @(#)find.c 8.5 (Berkeley) 8/5/94"; #else -__RCSID("$NetBSD: find.c,v 1.26 2010/12/27 16:09:46 christos Exp $"); +__RCSID("$NetBSD: find.c,v 1.27 2010/12/28 15:28:31 christos Exp $"); #endif #endif /* not lint */ @@ -159,12 +159,19 @@ static __inline void sig_init(void) { + struct sigaction sa; notty = !(isatty(STDIN_FILENO) || isatty(STDOUT_FILENO) || isatty(STDERR_FILENO)); if (notty) return; sigemptyset(&ss); sigaddset(&ss, SIGINFO); /* block SIGINFO */ + + memset(&sa, 0, sizeof(sa)); + sa.sa_flags = SA_RESTART; + sa.sa_handler = show_path; + (void)sigaction(SIGINFO, &sa, NULL); + } static __inline void Index: src/usr.bin/find/main.c diff -u src/usr.bin/find/main.c:1.28 src/usr.bin/find/main.c:1.29 --- src/usr.bin/find/main.c:1.28 Mon Jul 21 10:19:22 2008 +++ src/usr.bin/find/main.c Tue Dec 28 10:28:31 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.28 2008/07/21 14:19:22 lukem Exp $ */ +/* $NetBSD: main.c,v 1.29 2010/12/28 15:28:31 christos Exp $ */ /*- * Copyright (c) 1990, 1993, 1994 @@ -39,7 +39,7 @@ #else __COPYRIGHT("@(#) Copyright (c) 1990, 1993, 1994\ The Regents of the University of California. All rights reserved."); -__RCSID("$NetBSD: main.c,v 1.28 2008/07/21 14:19:22 lukem Exp $"); +__RCSID("$NetBSD: main.c,v 1.29 2010/12/28 15:28:31 christos Exp $"); #endif #endif /* not lint */ @@ -50,7 +50,6 @@ #include <errno.h> #include <fcntl.h> #include <fts.h> -#include <signal.h> #include <locale.h> #include <stdio.h> #include <stdlib.h> @@ -76,18 +75,12 @@ int main(int argc, char *argv[]) { - struct sigaction sa; char **p, **start; int ch; (void)time(&now); /* initialize the time-of-day */ (void)setlocale(LC_ALL, ""); - memset(&sa, 0, sizeof(sa)); - sa.sa_flags = SA_RESTART; - sa.sa_handler = show_path; - sigaction(SIGINFO, &sa, NULL); - /* array to hold dir list. at most (argc - 1) elements. */ p = start = malloc(argc * sizeof (char *)); if (p == NULL)