Add '=' condition when fd is compared for checking succeed status 03/179503/1
authorSungbae Yoo <sungbae.yoo@samsung.com>
Fri, 18 May 2018 08:14:43 +0000 (17:14 +0900)
committerSungbae Yoo <sungbae.yoo@samsung.com>
Fri, 18 May 2018 08:16:09 +0000 (17:16 +0900)
This is for solving svace issues

Change-Id: I0b38eab8e3cd0cbeaf3d134232a22bcf4f118490
Signed-off-by: Sungbae Yoo <sungbae.yoo@samsung.com>
tools/tests/groups/audit.cpp
tools/tests/groups/file.cpp
tools/tests/groups/mac.cpp

index 3210cdca9489bd6727673b8be023fa5fb42dd205..354060734f38775e3e4c3e4b8de6cdc7276ac45a 100644 (file)
@@ -41,7 +41,7 @@ public:
                int fd = -1;
                std::string auditSocketPath("/tmp/.audit-trail.sock");
                fd = open(auditSocketPath.c_str(), O_RDWR);
-               if (fd > 0)
+               if (fd >= 0)
                        close(fd);
 
                Display::printResult(Display::SUCCESS, "accessAuditSocketFile");
index 492e9f77a543b659888e149ce567fdf11b2e60b3..0b8f3fa77378f0365a387b822c96a16caddcf5d1 100644 (file)
@@ -145,7 +145,7 @@ public:
                open_by_handle_at_result:
                        if (handle)
                                free(handle);
-                       if (mountFd > 0)
+                       if (mountFd >= 0)
                                close(mountFd);
                        Display::printResult(ret, "open_by_handle_at(371) positive");
                }
@@ -388,7 +388,7 @@ public:
                //restore
                {
                        struct stat st;
-                       if (fd > 0)
+                       if (fd >= 0)
                                close(fd);
                        if ((lstat(fileName.c_str(), &st) == 0) && (unlink(fileName.c_str()) != 0)) {
                                Display::printError();
index ac0c9f4807a4b94b2062f2e4fe2041b9398cddbe..750edfd1aecca22abe6fe8d5ceba17571459da46 100644 (file)
@@ -51,7 +51,7 @@ public:
                {
                        int fd = -1;
                        fd = creat(smackPath.c_str(), 0644);
-                       if (fd > 0) {
+                       if (fd >= 0) {
                                writeRet = write(fd, writeString.c_str(), writeString.size());
                                _unused(writeRet);
                                close(fd);
@@ -64,7 +64,7 @@ public:
                {
                        int fd = -1;
                        fd = creat(smackfsPath.c_str(), 0644);
-                       if (fd > 0) {
+                       if (fd >= 0) {
                                writeRet = write(fd, writeString.c_str(), writeString.size());
                                _unused(writeRet);
                                close(fd);
@@ -77,7 +77,7 @@ public:
                {
                        int fd = -1;
                        fd = creat(cynaraPath.c_str(), 0644);
-                       if (fd > 0) {
+                       if (fd >= 0) {
                                writeRet = write(fd, writeString.c_str(), writeString.size());
                                _unused(writeRet);
                                close(fd);
@@ -90,7 +90,7 @@ public:
                {
                        int fd = -1;
                        fd = creat(netherPath.c_str(), 0644);
-                       if (fd > 0) {
+                       if (fd >= 0) {
                                writeRet = write(fd, writeString.c_str(), writeString.size());
                                _unused(writeRet);
                                close(fd);