Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.busybox.net/busybox.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2022-10-16 03:04:59 +0300
committerDenys Vlasenko <vda.linux@googlemail.com>2022-11-29 16:10:22 +0300
commit77216c368f3ae65c3a9fc504d28d3fadd46d6d8d (patch)
tree8f4bf1ca9cd3aea68214bc93ab5a586401979f47 /coreutils
parent75fbff1326674b768cee66f32e3799d5bff5e194 (diff)
Fix non-Linux builds
Various tools are Linuxish and should thus only attempted to build on Linux only. Some features are also Linux-only. Also, libresolv is used on all GNU platforms, notably GNU/Hurd and GNU/kfreeBSD. Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'coreutils')
-rw-r--r--coreutils/dd.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/coreutils/dd.c b/coreutils/dd.c
index 06c1b7b9c..3e034eb1e 100644
--- a/coreutils/dd.c
+++ b/coreutils/dd.c
@@ -200,6 +200,7 @@ static void dd_output_status(int UNUSED_PARAM cur_signal)
}
#if ENABLE_FEATURE_DD_IBS_OBS
+# ifdef O_DIRECT
static int clear_O_DIRECT(int fd)
{
if (errno == EINVAL) {
@@ -211,6 +212,7 @@ static int clear_O_DIRECT(int fd)
}
return 0;
}
+# endif
#endif
static ssize_t dd_read(void *ibuf, size_t ibs)
@@ -225,8 +227,10 @@ static ssize_t dd_read(void *ibuf, size_t ibs)
#endif
n = safe_read(ifd, ibuf, ibs);
#if ENABLE_FEATURE_DD_IBS_OBS
+# ifdef O_DIRECT
if (n < 0 && (G.flags & FLAG_IDIRECT) && clear_O_DIRECT(ifd))
goto read_again;
+# endif
#endif
return n;
}
@@ -239,8 +243,10 @@ static bool write_and_stats(const void *buf, size_t len, size_t obs,
IF_FEATURE_DD_IBS_OBS(write_again:)
n = full_write(ofd, buf, len);
#if ENABLE_FEATURE_DD_IBS_OBS
+# ifdef O_DIRECT
if (n < 0 && (G.flags & FLAG_ODIRECT) && clear_O_DIRECT(ofd))
goto write_again;
+# endif
#endif
#if ENABLE_FEATURE_DD_THIRD_STATUS_LINE
@@ -501,8 +507,13 @@ int dd_main(int argc UNUSED_PARAM, char **argv)
if (infile) {
int iflag = O_RDONLY;
#if ENABLE_FEATURE_DD_IBS_OBS
- if (G.flags & FLAG_IDIRECT)
+ if (G.flags & FLAG_IDIRECT) {
+# ifdef O_DIRECT
iflag |= O_DIRECT;
+# else
+ bb_error_msg_and_die("O_DIRECT not supported on this platform");
+# endif
+ }
#endif
xmove_fd(xopen(infile, iflag), ifd);
} else {
@@ -516,8 +527,13 @@ int dd_main(int argc UNUSED_PARAM, char **argv)
if (G.flags & FLAG_APPEND)
oflag |= O_APPEND;
#if ENABLE_FEATURE_DD_IBS_OBS
- if (G.flags & FLAG_ODIRECT)
+ if (G.flags & FLAG_ODIRECT) {
+# ifdef O_DIRECT
oflag |= O_DIRECT;
+# else
+ bb_error_msg_and_die("O_DIRECT not supported on this platform");
+# endif
+ }
#endif
xmove_fd(xopen(outfile, oflag), ofd);