diff options
author | Eric Blake <ebb9@byu.net> | 2009-03-19 20:14:26 +0100 |
---|---|---|
committer | Jim Meyering <meyering@redhat.com> | 2009-03-20 15:16:50 +0100 |
commit | 0b47305caa39c0b11f0488f0cc115fd6b09f7922 (patch) | |
tree | 386a0939f3e24277e491db07c55b7c2df45c31ef /src/dd.c | |
parent | 25bbb44dbb4d44b9718338aedeeae5c379596edb (diff) | |
download | coreutils-0b47305caa39c0b11f0488f0cc115fd6b09f7922.tar.xz |
dd: use a more portable definition of O_FULLBLOCK
* src/dd.c (O_FULLBLOCK): Compute its value without using a 180KB
macro. This avoids triggering a compilation failure with HP-UX's cc.
Reported by Matthew Woehlke.
Diffstat (limited to 'src/dd.c')
-rw-r--r-- | src/dd.c | 35 |
1 files changed, 20 insertions, 15 deletions
@@ -265,23 +265,28 @@ static struct symbol_value const conversions[] = enum { - /* Use a value that is larger than that of any other O_ symbol. */ - O_FULLBLOCK = ((MAX (O_APPEND, - MAX (O_BINARY, - MAX (O_CIO, - MAX (O_DIRECT, - MAX (O_DIRECTORY, - MAX (O_DSYNC, - MAX (O_NOATIME, - MAX (O_NOCTTY, - MAX (O_NOFOLLOW, - MAX (O_NOLINKS, - MAX (O_NONBLOCK, - MAX (O_SYNC, - MAX (O_TEXT, 0)))))))))))))) << 1) + /* Compute a value that's bitwise disjoint from the union + of all O_ values. */ + v = ~(0 + | O_APPEND + | O_BINARY + | O_CIO + | O_DIRECT + | O_DIRECTORY + | O_DSYNC + | O_NOATIME + | O_NOCTTY + | O_NOFOLLOW + | O_NOLINKS + | O_NONBLOCK + | O_SYNC + | O_TEXT + ), + /* Use its lowest bit. */ + O_FULLBLOCK = v ^ (v & (v - 1)) }; -/* Ensure that we didn't shift it off the end. */ +/* Ensure that we got something. */ verify (O_FULLBLOCK != 0); #define MULTIPLE_BITS_SET(i) (((i) & ((i) - 1)) != 0) |