diff options
author | Karel Zak | 2006-12-07 00:25:37 +0100 |
---|---|---|
committer | Karel Zak | 2006-12-07 00:25:37 +0100 |
commit | 5c36a0eb7cdb0360f9afd5d747c321f423b35984 (patch) | |
tree | 147599a77eaff2b5fbc0d389e89d2b51602326c0 /misc-utils/mcookie.c | |
parent | Imported from util-linux-2.8 tarball. (diff) | |
download | kernel-qcow2-util-linux-5c36a0eb7cdb0360f9afd5d747c321f423b35984.tar.gz kernel-qcow2-util-linux-5c36a0eb7cdb0360f9afd5d747c321f423b35984.tar.xz kernel-qcow2-util-linux-5c36a0eb7cdb0360f9afd5d747c321f423b35984.zip |
Imported from util-linux-2.9i tarball.
Diffstat (limited to 'misc-utils/mcookie.c')
-rw-r--r-- | misc-utils/mcookie.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/misc-utils/mcookie.c b/misc-utils/mcookie.c index 05136190f..33ae7630e 100644 --- a/misc-utils/mcookie.c +++ b/misc-utils/mcookie.c @@ -101,9 +101,12 @@ int main( int argc, char **argv ) } for (i = 0; i < RNGS; i++) { - if ((fd = open( rngs[i].path, O_RDONLY )) >= 0) { + if ((fd = open( rngs[i].path, O_RDONLY|O_NONBLOCK )) >= 0) { r = read( fd, buf, sizeof( buf ) ); - MD5Update( &ctx, buf, r ); + if (r > 0) + MD5Update( &ctx, buf, r ); + else + r = 0; close( fd ); if (Verbose) fprintf( stderr, "Got %d bytes from %s\n", r, rngs[i].path ); |