mirror of https://github.com/vitalif/e2fsprogs
ChangeLog, gen_uuid.c:
gen_uuid.c (get_random_bytes): Make more paranoid about misbehaving /dev/urandom. If we get a return of zero without an error more than 8 times in a row, we break out and return an error. Also, if /dev/urandom doesn't exist, try /dev/random. ChangeLog, ext2fs.h: ext2fs.h: Use AUTOCONF SIZEOF_* macros if available to determine how to define __s64 and __u64. Turn off "compression is experimental" warning if the cpp macro I_KNOW_THAT_COMPRESSION_IS_EXPERIMENTAL is defined.bitmap-optimize
parent
78f9351b46
commit
e589f678e1
|
@ -1,3 +1,10 @@
|
|||
2000-04-03 Theodore Ts'o <tytso@valinux.com>
|
||||
|
||||
* ext2fs.h: Use AUTOCONF SIZEOF_* macros if available to determine
|
||||
how to define __s64 and __u64. Turn off "compression is
|
||||
experimental" warning if the cpp macro
|
||||
I_KNOW_THAT_COMPRESSION_IS_EXPERIMENTAL is defined.
|
||||
|
||||
2000-02-11 <tytso@snap.thunk.org>
|
||||
|
||||
* ext2fs.h: Define EXT2FS_COMPRESSED_BLKADDR and HOLE_BLKADDR.
|
||||
|
|
|
@ -45,12 +45,17 @@
|
|||
#include "e2_types.h"
|
||||
#else
|
||||
#include <asm/types.h>
|
||||
#if defined(__GNUC__) && defined(__STRICT_ANSI__) && \
|
||||
(((~0UL) == 0xffffffff) || defined(__i386__))
|
||||
#if !defined(__GNUC__) || defined(__STRICT_ANSI__) /* asm/types.h already defines __s64 and __u64 otherwise */
|
||||
#if SIZEOF_LONG == 8
|
||||
typedef __signed__ long __s64;
|
||||
typedef unsigned long __u64;
|
||||
#elif SIZEOF_LONG_LONG == 8 || \
|
||||
defined(__GNUC__) && (((~0UL) == 0xffffffff) || defined(__i386__))
|
||||
typedef __signed__ long long __s64;
|
||||
typedef unsigned long long __u64;
|
||||
#endif /* SIZEOF_LONG == 8 */
|
||||
#endif
|
||||
#endif
|
||||
#endif /* EXT2_FLAT_INCLUDES */
|
||||
|
||||
typedef __u32 blk_t;
|
||||
typedef __u32 dgrp_t;
|
||||
|
@ -485,7 +490,12 @@ struct ext2fs_sb {
|
|||
EXT3_FEATURE_COMPAT_HAS_JOURNAL)
|
||||
/* This #ifdef is temporary until compression is fully supported */
|
||||
#ifdef ENABLE_COMPRESSION
|
||||
#ifndef I_KNOW_THAT_COMPRESSION_IS_EXPERIMENTAL
|
||||
/* If the below warning bugs you, then have
|
||||
`CPPFLAGS=-DI_KNOW_THAT_COMPRESSION_IS_EXPERIMENTAL' in your
|
||||
environment at configure time. */
|
||||
#warning "Compression support is experimental"
|
||||
#endif
|
||||
#define EXT2_LIB_FEATURE_INCOMPAT_SUPP (EXT2_FEATURE_INCOMPAT_FILETYPE|\
|
||||
EXT2_FEATURE_INCOMPAT_COMPRESSION)
|
||||
#else
|
||||
|
|
|
@ -1,3 +1,11 @@
|
|||
2000-03-12 Theodore Ts'o <tytso@valinux.com>
|
||||
|
||||
* gen_uuid.c (get_random_bytes): Make more paranoid about
|
||||
misbehaving /dev/urandom. If we get a return of zero
|
||||
without an error more than 8 times in a row, we break out
|
||||
and return an error. Also, if /dev/urandom doesn't exist,
|
||||
try /dev/random.
|
||||
|
||||
2000-01-18 Theodore Ts'o <tytso@valinux.com>
|
||||
|
||||
* Makefile.in: Since LIBUUID can sometimes include
|
||||
|
|
|
@ -49,22 +49,29 @@ static void get_random_bytes(void *buf, int nbytes)
|
|||
{
|
||||
static int fd = -2;
|
||||
int i;
|
||||
int lose_counter = 0;
|
||||
char *cp = (char *) buf;
|
||||
|
||||
if (fd == -2) {
|
||||
fd = open("/dev/urandom", O_RDONLY);
|
||||
if (fd == -1)
|
||||
fd = open("/dev/random", O_RDONLY);
|
||||
srand((getpid() << 16) ^ getuid() ^ time(0));
|
||||
}
|
||||
if (fd >= 0) {
|
||||
while (nbytes > 0) {
|
||||
i = read(fd, cp, nbytes);
|
||||
if (i < 0) {
|
||||
if ((errno == EINTR) || (errno == EAGAIN))
|
||||
continue;
|
||||
break;
|
||||
if ((i < 0) &&
|
||||
((errno == EINTR) || (errno == EAGAIN)))
|
||||
continue;
|
||||
if (i <= 0) {
|
||||
if (lose_counter++ == 8)
|
||||
break;
|
||||
continue;
|
||||
}
|
||||
nbytes -= i;
|
||||
cp += i;
|
||||
lose_counter = 0;
|
||||
}
|
||||
}
|
||||
if (nbytes == 0)
|
||||
|
|
Loading…
Reference in New Issue