2010-03-25 19:32:21

by djwong

[permalink] [raw]
Subject: [PATCH] e2fsprogs: e4defrag must open the file to be defragged in read/write mode

Akira Fujita merged a patch into 2.6.33 that adds a requirement that a file
being defragged must be opened with read and write access, so e2fsprogs needs
to satisfy that.

Signed-off-by: Darrick J. Wong <[email protected]>
--- a/misc/e4defrag.c
+++ b/misc/e4defrag.c
@@ -1605,7 +1605,7 @@ static int file_defrag(const char *file, const struct stat64 *buf,
return 0;
}

- fd = open64(file, O_RDONLY);
+ fd = open64(file, O_RDWR);
if (fd < 0) {
if (mode_flag & DETAIL) {
PRINT_FILE_NAME(file);