[PATCH] D101904: [SystemZ][z/OS] Fix return values in AutoConversion functions
Abhina Sree via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed May 5 06:02:21 PDT 2021
abhina.sreeskantharajan created this revision.
Herald added subscribers: dexonsmith, hiraditya.
abhina.sreeskantharajan requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
My previous patch https://reviews.llvm.org/rG1527a5e4b4834e65678f9c30f786a2f4c17932bf incorrectly set int return values instead of std::error_code. This patch correctly returns and std::error_code value.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D101904
Files:
llvm/lib/Support/AutoConvert.cpp
Index: llvm/lib/Support/AutoConvert.cpp
===================================================================
--- llvm/lib/Support/AutoConvert.cpp
+++ llvm/lib/Support/AutoConvert.cpp
@@ -23,7 +23,9 @@
0, // pccsid
(short)FT_BINARY, // fccsid
};
- return fcntl(FD, F_CONTROL_CVT, &Convert);
+ if (fcntl(FD, F_CONTROL_CVT, &Convert) == -1)
+ return std::error_code(errno, std::generic_category());
+ return std::error_code();
}
std::error_code llvm::enableAutoConversion(int FD) {
@@ -34,7 +36,7 @@
};
if (fcntl(FD, F_CONTROL_CVT, &Query) == -1)
- return -1;
+ return std::error_code(errno, std::generic_category());
Query.cvtcmd = SETCVTALL;
Query.pccsid =
@@ -43,7 +45,9 @@
: CCSID_UTF_8;
// Assume untagged files to be IBM-1047 encoded.
Query.fccsid = (Query.fccsid == FT_UNTAGGED) ? CCSID_IBM_1047 : Query.fccsid;
- return fcntl(FD, F_CONTROL_CVT, &Query);
+ if (fcntl(FD, F_CONTROL_CVT, &Query) == -1)
+ return std::error_code(errno, std::generic_category());
+ return std::error_code();
}
std::error_code llvm::setFileTag(int FD, int CCSID, bool Text) {
@@ -55,7 +59,9 @@
Tag.ft_deferred = 0;
Tag.ft_rsvflags = 0;
- return fcntl(FD, F_SETTAG, &Tag);
+ if (fcntl(FD, F_SETTAG, &Tag) == -1)
+ return std::error_code(errno, std::generic_category());
+ return std::error_code();
}
#endif // __MVS__
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D101904.343019.patch
Type: text/x-patch
Size: 1407 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210505/9a7b98c9/attachment.bin>
More information about the llvm-commits
mailing list