]> git.ipfire.org Git - thirdparty/e2fsprogs.git/commitdiff
libext2fs: make ext2fs_open_file() always use 3 arguments instead of varargs
authorTheodore Ts'o <tytso@mit.edu>
Thu, 6 Oct 2011 17:28:07 +0000 (13:28 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Thu, 6 Oct 2011 17:28:07 +0000 (13:28 -0400)
Some architectures have narrow mode_t's which can cause some
portability warnings with varargs.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
lib/ext2fs/ext2fs.h
lib/ext2fs/getsectsize.c
lib/ext2fs/getsize.c
lib/ext2fs/unix_io.c
misc/e2image.c
resize/main.c

index b04b0d1eb5289b39543722e73b3cff654d6d4897..411a383a6058347da030d228a5a3644ba4eb20f0 100644 (file)
@@ -1438,7 +1438,7 @@ extern blk_t ext2fs_inode_data_blocks(ext2_filsys fs,
                                      struct ext2_inode *inode);
 extern unsigned int ext2fs_div_ceil(unsigned int a, unsigned int b);
 extern __u64 ext2fs_div64_ceil(__u64 a, __u64 b);
-extern int ext2fs_open_file(const char *pathname, int flags, ...);
+extern int ext2fs_open_file(const char *pathname, int flags, mode_t mode);
 extern int ext2fs_stat(const char *path, ext2fs_struct_stat *buf);
 extern int ext2fs_fstat(int fd, ext2fs_struct_stat *buf);
 
@@ -1691,14 +1691,9 @@ _INLINE_ __u64 ext2fs_div64_ceil(__u64 a, __u64 b)
        return ((a - 1) / b) + 1;
 }
 
-_INLINE_ int ext2fs_open_file(const char *pathname, int flags, ...)
+_INLINE_ int ext2fs_open_file(const char *pathname, int flags, mode_t mode)
 {
        va_list args;
-       mode_t mode;
-
-       va_start(args, flags);
-       mode = va_arg(args, mode_t);
-       va_end(args);
 
        if (mode)
 #if defined(HAVE_OPEN64) && !defined(__OSX_AVAILABLE_BUT_DEPRECATED)
index 9d615531bd28a3de320121d01e07894eaa8f35b6..30faecc790ec9aa39f709f52990d1bdbe7e44160 100644 (file)
@@ -46,7 +46,7 @@ errcode_t ext2fs_get_device_sectsize(const char *file, int *sectsize)
 {
        int     fd;
 
-       fd = ext2fs_open_file(file, O_RDONLY);
+       fd = ext2fs_open_file(file, O_RDONLY, 0);
        if (fd < 0)
                return errno;
 
@@ -68,7 +68,7 @@ errcode_t ext2fs_get_device_phys_sectsize(const char *file, int *sectsize)
 {
        int     fd;
 
-       fd = ext2fs_open_file(file, O_RDONLY);
+       fd = ext2fs_open_file(file, O_RDONLY, 0);
        if (fd < 0)
                return errno;
 
index a2e6e4724b4d5e519b5fd67b1a56c113862eca24..1e0ed16fc6df51cb26784929fc862cd844e43402 100644 (file)
@@ -160,7 +160,7 @@ errcode_t ext2fs_get_device_size2(const char *file, int blocksize,
        char ch;
 #endif /* HAVE_SYS_DISKLABEL_H */
 
-       fd = ext2fs_open_file(file, O_RDONLY);
+       fd = ext2fs_open_file(file, O_RDONLY, 0);
        if (fd < 0)
                return errno;
 
index 787990d7db62301c552684984beee9195b267711..53370224233e16bb07980726734422acc0dd7395 100644 (file)
@@ -486,7 +486,7 @@ static errcode_t unix_open(const char *name, int flags, io_channel *channel)
 #endif
        data->flags = flags;
 
-       data->dev = ext2fs_open_file(io->name, open_flags);
+       data->dev = ext2fs_open_file(io->name, open_flags, 0);
        if (data->dev < 0) {
                retval = errno;
                goto cleanup;
index c108a7a234247b58ce0788ae987b468accfb7974..23a4df27d65b76c1c1ba9a5a8b0e8d7cbe80b382 100644 (file)
@@ -1178,7 +1178,7 @@ static void install_image(char *device, char *image_fn, int type)
                exit(1);
        }
 
-       fd = ext2fs_open_file(image_fn, O_RDONLY);
+       fd = ext2fs_open_file(image_fn, O_RDONLY, 0);
        if (fd < 0) {
                perror(image_fn);
                exit(1);
index e6e9e7bd53ba1155bf66642cf881c909c6b9ad0d..1ab0e048d1b88487914da0a0b627ec5a3e7f518f 100644 (file)
@@ -258,7 +258,7 @@ int main (int argc, char ** argv)
                len = 2 * len;
        }
 
-       fd = ext2fs_open_file(device_name, O_RDWR);
+       fd = ext2fs_open_file(device_name, O_RDWR, 0);
        if (fd < 0) {
                com_err("open", errno, _("while opening %s"),
                        device_name);