[libbsd 5/9] ping: Do not use signals

Sebastian Huber sebastian.huber at embedded-brains.de
Fri Jun 10 06:08:31 UTC 2022


---
 freebsd/sbin/ping/ping.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/freebsd/sbin/ping/ping.c b/freebsd/sbin/ping/ping.c
index 71976058..0daa5f45 100644
--- a/freebsd/sbin/ping/ping.c
+++ b/freebsd/sbin/ping/ping.c
@@ -306,7 +306,9 @@ main(int argc, char *const *argv)
 #endif
 	struct sockaddr_in *to;
 	double t;
+#ifndef __rtems__
 	u_long alarmtimeout;
+#endif /* __rtems__ */
 	long ltmp;
 	int almost_done, ch, df, hold, i, icmp_len, mib[4], preload;
 	int ssend_errno, srecv_errno, tos, ttl;
@@ -370,7 +372,9 @@ main(int argc, char *const *argv)
 		err(EX_OSERR, "srecv socket");
 	}
 
+#ifndef __rtems__
 	alarmtimeout = df = preload = tos = 0;
+#endif /* __rtems__ */
 
 	outpack = outpackhdr + sizeof(struct ip);
 	while ((ch = getopt(argc, argv,
@@ -569,6 +573,7 @@ main(int argc, char *const *argv)
 			mttl = ltmp;
 			options |= F_MTTL;
 			break;
+#ifndef __rtems__
 		case 't':
 			alarmtimeout = strtoul(optarg, &ep, 0);
 			if ((alarmtimeout < 1) || (alarmtimeout == ULONG_MAX))
@@ -579,6 +584,7 @@ main(int argc, char *const *argv)
 				    optarg, MAXALARM);
 			alarm((int)alarmtimeout);
 			break;
+#endif /* __rtems__ */
 		case 'v':
 			options |= F_VERBOSE;
 			break;
@@ -1529,8 +1535,10 @@ static void
 finish(void)
 {
 
+#ifndef __rtems__
 	(void)signal(SIGINT, SIG_IGN);
 	(void)signal(SIGALRM, SIG_IGN);
+#endif /* __rtems__ */
 	(void)putchar('\n');
 	(void)fflush(stdout);
 	(void)printf("--- %s ping statistics ---\n", hostname);
-- 
2.35.3



More information about the devel mailing list