diff options
-rw-r--r-- | Alc/helpers.cpp | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/Alc/helpers.cpp b/Alc/helpers.cpp index 864278bb..0505c729 100644 --- a/Alc/helpers.cpp +++ b/Alc/helpers.cpp @@ -484,21 +484,19 @@ PathNamePair GetProcBinary() { pathname.resize(pathlen + 1); sysctl(mib, 4, pathname.data(), &pathlen, nullptr, 0); - pathname[pathlen] = 0; + pathname.resize(pathlen); } #endif #ifdef HAVE_PROC_PIDPATH if(pathname.empty()) { - const pid_t pid = getpid(); - char procpath[PROC_PIDPATHINFO_MAXSIZE]; - int ret; - - ret = proc_pidpath(pid, procpath, sizeof(procpath)); + char procpath[PROC_PIDPATHINFO_MAXSIZE]{}; + const pid_t pid{getpid()}; + const int ret{proc_pidpath(pid, procpath, sizeof(procpath))}; if(ret < 1) - WARN("proc_pidpath(%d, ...) failed: %s\n", pid, strerror(errno)); + ERR("proc_pidpath(%d, ...) failed: %s\n", pid, strerror(errno)); else - pathname.append(procpath, procpath+strlen(procpath)); + pathname.insert(pathname.end(), procpath, procpath+strlen(procpath)); } #endif if(pathname.empty()) |