From: Aleksei Vereshchagin Date: Wed, 5 Sep 2018 16:26:17 +0000 (+0300) Subject: Pipe creation refactoring X-Git-Tag: submit/tizen/20180911.125435~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3ecbeb368ef2098bf94558442ba879d5534f2b9b;p=sdk%2Ftools%2Fprofctl.git Pipe creation refactoring --- diff --git a/profctl.c b/profctl.c index e3d918b..5b42925 100644 --- 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