summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mcastseed/src/random_speed_dd.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/mcastseed/src/random_speed_dd.c b/mcastseed/src/random_speed_dd.c
index 0c11c05..1fbc863 100644
--- a/mcastseed/src/random_speed_dd.c
+++ b/mcastseed/src/random_speed_dd.c
@@ -6,11 +6,11 @@
char buf[0xffff];
int main() {
- size_t nread, nwrite, remains;
+ ssize_t nread, nwrite, remains;
- srandom(1); // Always the same pseudo-random sequence
+ srandom(1); /* Always the same pseudo-random sequence */
- while ( (nread=read(0, buf, 0xf & rand())) >= 0 ) {
+ while ( (nread=read(0, buf, 0xfff & rand())) > 0 ) {
remains = nread;
while ( remains ) {
nwrite=write(1, buf, nread);
@@ -23,8 +23,12 @@ int main() {
remains -= nwrite;
}
}
- //fprintf(stderr, "nread==%zi, nwrite==%zi\n", nread, nwrite);
- usleep( 0xfffff & rand() );
+ /*fprintf(stderr, "nread==%zu, nwrite==%zu\n", nread, nwrite);*/
+ usleep( 0xffff & rand() );
+ }
+ if ( nread < 0 ) {
+ perror("read");
+ return nread;
}
return 0;