From cc3112efd6d229a12d0b101ff29e87df10daa708 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Wed, 6 Aug 2014 17:01:29 -0700 Subject: [PATCH] rados: use STD{IN,OUT}_FILENO for magic values Signed-off-by: Sage Weil --- src/tools/rados/rados.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/tools/rados/rados.cc b/src/tools/rados/rados.cc index adb357bd61f9..1e7a4a5bbd4a 100644 --- a/src/tools/rados/rados.cc +++ b/src/tools/rados/rados.cc @@ -195,7 +195,7 @@ static int dump_data(std::string const &filename, bufferlist const &data) { int fd; if (filename == "-") { - fd = 1; + fd = STDOUT_FILENO; } else { fd = TEMP_FAILURE_RETRY(::open(filename.c_str(), O_WRONLY|O_CREAT|O_TRUNC, 0644)); if (fd < 0) { @@ -221,7 +221,7 @@ static int do_get(IoCtx& io_ctx, const char *objname, const char *outfile, unsig int fd; if (strcmp(outfile, "-") == 0) { - fd = 1; + fd = STDOUT_FILENO; } else { fd = TEMP_FAILURE_RETRY(::open(outfile, O_WRONLY|O_CREAT|O_TRUNC, 0644)); if (fd < 0) { @@ -411,7 +411,7 @@ static int do_put(IoCtx& io_ctx, const char *objname, const char *infile, int op stdio = true; int ret; - int fd = 0; + int fd = STDIN_FILENO; if (!stdio) fd = open(infile, O_RDONLY); if (fd < 0) { @@ -1652,7 +1652,7 @@ static int rados_tool_common(const std::map < std::string, std::string > &opts, bl.append(attr_val.c_str(), attr_val.length()); } else { do { - ret = bl.read_fd(0, 1024); // from stdin + ret = bl.read_fd(STDIN_FILENO, 1024); // from stdin if (ret < 0) goto out; } while (ret > 0); -- 2.47.3