diff --git a/cfg.mk b/cfg.mk index d3c96bafc4..50e6a50c69 100644 --- a/cfg.mk +++ b/cfg.mk @@ -386,7 +386,7 @@ sc_prohibit_sprintf: $(_sc_search_regexp) sc_prohibit_readlink: - @prohibit='readlink *\(' \ + @prohibit='\ deletedTextLen) + procLink[procLinkLen - deletedTextLen] = 0; + + if ((ret = virFileResolveAllLinks(binPath, &resolvedBinPath)) < 0) + goto cleanup; + if ((ret = virFileResolveAllLinks(procLink, &resolvedProcLink)) < 0) + goto cleanup; + + ret = STREQ(resolvedBinPath, resolvedProcLink) ? 0 : -1; + +cleanup: + VIR_FREE(procPath); + VIR_FREE(procLink); + VIR_FREE(resolvedProcLink); + VIR_FREE(resolvedBinPath); + + /* return the originally set pid of -1 unless we proclaim success */ + if (ret == 0) + *pid = retPid; + return ret; }