Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F167882309
D57884.id180713.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D57884.id180713.diff
View Options
diff --git a/sbin/ping/ping.c b/sbin/ping/ping.c
--- a/sbin/ping/ping.c
+++ b/sbin/ping/ping.c
@@ -982,8 +982,10 @@
(void)clock_gettime(CLOCK_MONOTONIC, &last);
if (ntransmitted - nreceived - 1 > nmissedmax) {
nmissedmax = ntransmitted - nreceived - 1;
- if (options & F_MISSED)
- (void)write(STDOUT_FILENO, &BBELL, 1);
+ if (options & F_MISSED) {
+ (void)putc(BBELL, stdout);
+ (void)fflush(stdout);
+ }
}
}
}
@@ -1084,8 +1086,10 @@
}
ntransmitted++;
sntransmitted++;
- if (!(options & F_QUIET) && options & F_DOT)
- (void)write(STDOUT_FILENO, &DOT[DOTidx++ % DOTlen], 1);
+ if (!(options & F_QUIET) && options & F_DOT) {
+ (void)putc(DOT[DOTidx++ % DOTlen], stdout);
+ (void)fflush(stdout);
+ }
}
/*
@@ -1207,9 +1211,10 @@
return;
}
- if (options & F_DOT)
- (void)write(STDOUT_FILENO, &BSPACE, 1);
- else {
+ if (options & F_DOT) {
+ (void)putc(BSPACE, stdout);
+ (void)fflush(stdout);
+ } else {
(void)printf("%zd bytes from %s: icmp_seq=%u", cc,
pr_addr(from->sin_addr), seq);
(void)printf(" ttl=%d", ip.ip_ttl);
@@ -1217,8 +1222,10 @@
(void)printf(" time=%.3f ms", triptime);
if (dupflag)
(void)printf(" (DUP!)");
- if (options & F_AUDIBLE)
- (void)write(STDOUT_FILENO, &BBELL, 1);
+ if (options & F_AUDIBLE) {
+ (void)putc(BBELL, stdout);
+ (void)fflush(stdout);
+ }
if (options & F_MASK) {
/* Just prentend this cast isn't ugly */
(void)printf(" mask=%s",
diff --git a/sbin/ping/ping6.c b/sbin/ping/ping6.c
--- a/sbin/ping/ping6.c
+++ b/sbin/ping/ping6.c
@@ -1242,8 +1242,10 @@
clock_gettime(CLOCK_MONOTONIC, &last);
if (ntransmitted - nreceived - 1 > nmissedmax) {
nmissedmax = ntransmitted - nreceived - 1;
- if (options & F_MISSED)
- (void)write(STDOUT_FILENO, &BBELL, 1);
+ if (options & F_MISSED) {
+ (void)putc(BBELL, stdout);
+ (void)fflush(stdout);
+ }
}
}
}
@@ -1419,8 +1421,10 @@
(void)printf("ping: wrote %s %d chars, ret=%d\n",
hostname, cc, i);
}
- if (!(options & F_QUIET) && options & F_DOT)
- (void)write(STDOUT_FILENO, &DOT[DOTidx++ % DOTlen], 1);
+ if (!(options & F_QUIET) && options & F_DOT) {
+ (void)putc(DOT[DOTidx++ % DOTlen], stdout);
+ (void)fflush(stdout);
+ }
return(0);
}
@@ -1617,11 +1621,14 @@
return;
}
- if (options & F_DOT)
- (void)write(STDOUT_FILENO, &BSPACE, 1);
- else {
- if (options & F_AUDIBLE)
- (void)write(STDOUT_FILENO, &BBELL, 1);
+ if (options & F_DOT) {
+ (void)putc(BSPACE, stdout);
+ (void)fflush(stdout);
+ } else {
+ if (options & F_AUDIBLE) {
+ (void)putc(BBELL, stdout);
+ (void)fflush(stdout);
+ }
(void)printf("%d bytes from %s, icmp_seq=%u", cc,
pr_addr(from, fromlen), seq);
(void)printf(" hlim=%d", hoplim);
@@ -1810,7 +1817,7 @@
}
if (!(options & F_DOT)) {
- (void)putchar('\n');
+ (void)putc('\n', stdout);
if (options & F_VERBOSE)
pr_exthdrs(mhdr);
(void)fflush(stdout);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Aug 26, 5:48 AM (6 h, 51 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
37270556
Default Alt Text
D57884.id180713.diff (2 KB)
Attached To
Mode
D57884: ping: Don't mix stdio and direct writes
Attached
Detach File
Event Timeline
Log In to Comment