# HG changeset patch # User KUBOTA Yuji # Date 1405499448 -32400 # Node ID 6122238e585592d7187e4c8947d839d19e9965da # Parent e52df4e1bc2b85668748e4000f862866965bcf70 Bug 1861: Improve the messaging about gathering stdout/stderr. reviewed-by: yasuenag diff -r e52df4e1bc2b -r 6122238e5855 agent/src/fsUtil.cpp --- a/agent/src/fsUtil.cpp Mon Jul 07 20:21:58 2014 +0900 +++ b/agent/src/fsUtil.cpp Wed Jul 16 17:30:48 2014 +0900 @@ -226,6 +226,7 @@ if((st.st_mode & S_IFMT) != S_IFREG){ /* File isn't regular file. This route is not error. */ + PRINT_DEBUG_MSG_HEADER << "Couldn't copy file. Not a regular file: " << path << NEWLINE; return false; } diff -r e52df4e1bc2b -r 6122238e5855 agent/src/logManager.cpp --- a/agent/src/logManager.cpp Mon Jul 07 20:21:58 2014 +0900 +++ b/agent/src/logManager.cpp Wed Jul 16 17:30:48 2014 +0900 @@ -1358,28 +1358,42 @@ } } - /* Copy stdout */ - result = copyFile("/proc/self/fd/1", basePath, "fd1"); - if(unlikely(result != 0)){ - PRINT_WARN_MSG_AND_ERRNO("Failure copy file. path:\"stdout\"", result); + /* Copy file descriptors, i.e. stdout and stderr, as avoid double work. */ + const int fdNum = 2; + const char streamList[fdNum][255] = { + /* Standard streams */ + "/proc/self/fd/1", "/proc/self/fd/2", + }; + + const char fdFile[fdNum][10] = {"fd1", "fd2"}; + char fdPath[fdNum][PATH_MAX]; + struct stat fdStat[fdNum]; - /* If disk is full. */ - if(unlikely(isRaisedDiskFull(result))){ - return result; + for (int i=0; i