Pipe creation refactoring
authorAleksei Vereshchagin <avereschagin@dev.rtsoft.ru>
Wed, 5 Sep 2018 16:26:17 +0000 (19:26 +0300)
committerAleksei Vereshchagin <avereschagin@dev.rtsoft.ru>
Mon, 10 Sep 2018 14:00:10 +0000 (17:00 +0300)
profctl.c

index e3d918bed4e5b3d4b4138b32d75e424608c02685..5b42925a00daaf2482e26d0d6da4148b2b436186 100644 (file)
--- a/profctl.c
+++ b/profctl.c
@@ -636,17 +636,26 @@ int main(int argc, char **argv)
        }
 
        if (pname && isPipeOwner) {
-               unlink(pname);
-               if (mkfifo(pname, 0666)) {
-                       log_system_error_and_exit("mkfifo(%s)", pname);
+               // TODO: should be refactored: move to separate function
+               int result = 0;
+
+               result = unlink(pname);
+               if (result == 0) {
+                       if (verbose) {
+                               log_message("unlink(%s)", pname);
+                       }
+               } else if (errno != ENOENT) {
+                       log_system_error_and_exit("unlink(%s)", pname);
                }
-#if TIZEN
-               /* This may be useful for "root on" start */
-               if (setxattr(pname, "security.SMACK64", "User::App::Shared",
-                               strlen("User::App::Shared"),0)) {
-                       log_system_error("setattr");
+
+               result = mkfifo(pname, 0666);
+               if (result == 0) {
+                       if (verbose) {
+                               log_message("mkfifo(%s)", pname);
+                       }
+               } else {
+                       log_system_error_and_exit("mkfifo(%s)", pname);
                }
-#endif /* TIZEN */
        }
 
 #if TIZEN