summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorTheodore Ts'o <tytso@mit.edu>2002-07-14 08:33:32 -0400
committerTheodore Ts'o <tytso@mit.edu>2002-07-14 08:33:32 -0400
commitf154d2f687e922f8444ef3050dc83f5d8e0e2178 (patch)
tree04597d49da2fc7b16bdd87f20c042254feb4a9a8 /lib
parent7098810daf7d1ba9287a51dc596d78d70d270337 (diff)
downloade2fsprogs-f154d2f687e922f8444ef3050dc83f5d8e0e2178.tar.gz
unix_io.c (unix_open): Only attempt the setrlimit workaround if
the kernel version is 2.4.10 -- 2.4.17, since otherwise an old version of glibc (built against 2.2 headers) will interact badly with the workaround to actually cause more problems. I hate it when the glibc folks think they're being smarter than the kernel....
Diffstat (limited to 'lib')
-rw-r--r--lib/ext2fs/ChangeLog9
-rw-r--r--lib/ext2fs/unix_io.c20
2 files changed, 26 insertions, 3 deletions
diff --git a/lib/ext2fs/ChangeLog b/lib/ext2fs/ChangeLog
index 55eae2e8..e67e57dc 100644
--- a/lib/ext2fs/ChangeLog
+++ b/lib/ext2fs/ChangeLog
@@ -1,3 +1,12 @@
+2002-07-14 Theodore Ts'o <tytso@mit.edu>
+
+ * unix_io.c (unix_open): Only attempt the setrlimit workaround if
+ the kernel version is 2.4.10 -- 2.4.17, since otherwise an
+ old version of glibc (built against 2.2 headers) will
+ interact badly with the workaround to actually cause more
+ problems. I hate it when the glibc folks think they're
+ being smarter than the kernel....
+
2002-06-28 Andreas Dilger <adilger@clusterfs.com>
* ext2_fs.h: Add superblock field for reserved group descriptors.
diff --git a/lib/ext2fs/unix_io.c b/lib/ext2fs/unix_io.c
index 9b3b6ab2..e8cd880c 100644
--- a/lib/ext2fs/unix_io.c
+++ b/lib/ext2fs/unix_io.c
@@ -25,6 +25,9 @@
#endif
#include <fcntl.h>
#include <time.h>
+#ifdef __linux__
+#include <sys/utsname.h>
+#endif
#if HAVE_SYS_STAT_H
#include <sys/stat.h>
#endif
@@ -296,6 +299,9 @@ static errcode_t unix_open(const char *name, int flags, io_channel *channel)
errcode_t retval;
int open_flags;
struct stat st;
+#ifdef __linux__
+ struct utsname ut;
+#endif
if (name == 0)
return EXT2_ET_BAD_DEVICE_NAME;
@@ -347,10 +353,18 @@ static errcode_t unix_open(const char *name, int flags, io_channel *channel)
#define RLIM_INFINITY (~0UL)
#endif
/*
- * Work around a bug in 2.4.10+ kernels where writes to block
- * devices are wrongly getting hit by the filesize limit.
+ * Work around a bug in 2.4.10-2.4.18 kernels where writes to
+ * block devices are wrongly getting hit by the filesize
+ * limit. This workaround isn't perfect, since it won't work
+ * if glibc wasn't built against 2.2 header files. (Sigh.)
+ *
*/
- if ((flags & IO_FLAG_RW) &&
+ if ((flags & IO_FLAG_RW) &&
+ (uname(&ut) == 0) &&
+ ((ut.release[0] == '2') && (ut.release[1] == '.') &&
+ (ut.release[2] == '4') && (ut.release[3] == '.') &&
+ (ut.release[4] == '1') && (ut.release[5] >= '0') &&
+ (ut.release[5] < '8')) &&
(fstat(data->dev, &st) == 0) &&
(S_ISBLK(st.st_mode))) {
struct rlimit rlim;