Check the error value Before printing error logs 54/236854/1
authorHwankyu Jhun <h.jhun@samsung.com>
Tue, 23 Jun 2020 01:21:15 +0000 (10:21 +0900)
committerHwankyu Jhun <h.jhun@samsung.com>
Tue, 23 Jun 2020 01:21:15 +0000 (10:21 +0900)
If the error value is -ENOENT(No such file or directory), the process
doesn't print the error logs.

Change-Id: I15548f966b4c28928f0f460c4be5a611df57503d
Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
src/common/src/launchpad_common.c

index d2bf965..fdb2455 100644 (file)
@@ -950,7 +950,8 @@ static int __redirect_stdout(const char *ident)
 
        fd = sd_journal_stream_fd(ident, LOG_INFO, 0);
        if (fd < 0) {
-               _W("sd_journal_stream_fd() is failed. error(%d)", fd);
+               if (fd != -ENOENT)
+                       _W("sd_journal_stream_fd() is failed. error(%d)", fd);
                return fd;
        }
 
@@ -969,7 +970,8 @@ static int __redirect_stderr(const char *ident)
 
        fd = sd_journal_stream_fd(ident, LOG_WARNING, 0);
        if (fd < 0) {
-               _W("sd_journal_stream_fd() is failed. error(%d)", fd);
+               if (fd != -ENOENT)
+                       _W("sd_journal_stream_fd() is failed. error(%d)", fd);
                return fd;
        }