aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Biggers <ebiggers@google.com>2023-01-21 12:32:11 -0800
committerTheodore Ts'o <tytso@mit.edu>2023-01-27 12:38:31 -0500
commita5ea0052b1bb740614b778bea55ec922f16aa3aa (patch)
tree93e14703f33ffbfe2e29aa35c7f429834a3f07f5
parent37176e146147db576ae008093cdcac9b083c0f88 (diff)
downloade2fsprogs-a5ea0052b1bb740614b778bea55ec922f16aa3aa.tar.gz
lib/ext2fs: fix two compiler warnings in windows_io.c
init_private_data() triggers a -Wstringop-truncation warning, due to a real bug. Fix it. windows_open() has a -Wunused-variable warning because some macOS-specific code was copied there for no reason. Remove it. Signed-off-by: Eric Biggers <ebiggers@google.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
-rw-r--r--lib/ext2fs/windows_io.c12
1 files changed, 1 insertions, 11 deletions
diff --git a/lib/ext2fs/windows_io.c b/lib/ext2fs/windows_io.c
index 68b5571bb..83aea68b6 100644
--- a/lib/ext2fs/windows_io.c
+++ b/lib/ext2fs/windows_io.c
@@ -499,9 +499,6 @@ static errcode_t windows_open_channel(struct windows_private_data *data,
#if defined(O_DIRECT)
if (flags & IO_FLAG_DIRECT_IO)
io->align = ext2fs_get_dio_alignment(data->dev);
-#elif defined(F_NOCACHE)
- if (flags & IO_FLAG_DIRECT_IO)
- io->align = 4096;
#endif
/*
@@ -609,7 +606,7 @@ static struct windows_private_data *init_private_data(const char *name, int flag
return NULL;
memset(data, 0, sizeof(struct windows_private_data));
- strncpy(data->name, name, sizeof(data->name));
+ strncpy(data->name, name, sizeof(data->name) - 1);
data->magic = EXT2_ET_MAGIC_WINDOWS_IO_CHANNEL;
data->io_stats.num_fields = 2;
data->flags = flags;
@@ -620,7 +617,6 @@ static struct windows_private_data *init_private_data(const char *name, int flag
static errcode_t windows_open(const char *name, int flags, io_channel *channel)
{
- int fd = -1;
int open_flags;
struct windows_private_data *data;
@@ -644,12 +640,6 @@ static errcode_t windows_open(const char *name, int flags, io_channel *channel)
return EXT2_ET_BAD_DEVICE_NAME;
}
-#if defined(F_NOCACHE) && !defined(IO_DIRECT)
- if (flags & IO_FLAG_DIRECT_IO) {
- if (fcntl(fd, F_NOCACHE, 1) < 0)
- return errno;
- }
-#endif
return windows_open_channel(data, flags, channel, windows_io_manager);
}