The test needs to check dup2 syscall status and not the
errno val

Change-Id: Ic88eb2047b839adbc9e12965b098d8960cd7e2b8


[ROCm/hip commit: 7720651f2d]
Этот коммит содержится в:
Saleel Kudchadker
2020-08-31 13:15:50 -07:00
родитель f985a8d247
Коммит 7c60cf0a5b
+6 -12
Просмотреть файл
@@ -21,20 +21,17 @@ struct CaptureStream {
orig_fd = fileno(original);
saved_fd = dup(orig_fd);
temp_fd = mkstemp(tempname);
if (errno) {
if ((temp_fd = mkstemp(tempname)) == -1) {
error(0, errno, "Error");
assert(false);
}
fflush(nullptr);
dup2(temp_fd, orig_fd);
if (errno) {
if (dup2(temp_fd, orig_fd) == -1) {
error(0, errno, "Error");
assert(false);
}
close(temp_fd);
if (errno) {
if (close(temp_fd) != 0) {
error(0, errno, "Error");
assert(false);
}
@@ -44,13 +41,11 @@ struct CaptureStream {
if (saved_fd == -1)
return;
fflush(nullptr);
dup2(saved_fd, orig_fd);
if (errno) {
if (dup2(saved_fd, orig_fd) == -1) {
error(0, errno, "Error");
assert(false);
}
close(saved_fd);
if (errno) {
if (close(saved_fd) != 0) {
error(0, errno, "Error");
assert(false);
}
@@ -65,8 +60,7 @@ struct CaptureStream {
~CaptureStream() {
restoreStream();
remove(tempname);
if (errno) {
if (remove(tempname) != 0) {
error(0, errno, "Error");
assert(false);
}