]> git.ipfire.org Git - thirdparty/e2fsprogs.git/blobdiff - lib/ext2fs/unix_io.c
Merge branch 'maint' into next
[thirdparty/e2fsprogs.git] / lib / ext2fs / unix_io.c
index c2ce9a10f1c5acbbd53b5630f41cef6ce6de0be1..c6b058d1c927a81d445461fbe5a5bcd8ec28ecd3 100644 (file)
@@ -722,6 +722,7 @@ static errcode_t unixfd_open(const char *str_fd, int flags,
        int fd_flags;
 
        fd = atoi(str_fd);
+#if defined(HAVE_FCNTL)
        fd_flags = fcntl(fd, F_GETFD);
        if (fd_flags == -1)
                return -EBADF;
@@ -735,6 +736,7 @@ static errcode_t unixfd_open(const char *str_fd, int flags,
        if (fd_flags & O_DIRECT)
                flags |= IO_FLAG_DIRECT_IO;
 #endif
+#endif  /* HAVE_FCNTL */
 
        return unix_open_channel(str_fd, fd, flags, channel, unixfd_io_manager);
 }
@@ -1034,8 +1036,10 @@ static errcode_t unix_flush(io_channel channel)
 #ifndef NO_IO_CACHE
        retval = flush_cached_blocks(channel, data, 0);
 #endif
+#ifdef HAVE_FSYNC
        if (!retval && fsync(data->dev) != 0)
                return errno;
+#endif
        return retval;
 }