提交 1dfc3567 编写于 作者: G Guido Günther

check for NULL pointers in pidfile functions

上级 7ee54d83
Thu May 7 09:26:50 CEST 2009 Guido Günther <agx@sigxcpu.org>
* src/util.c (virFileWritePid): check for NULL pointers
to avoid bogus pid files
(virFileReadPid): likewise
(virFileDeletePid): likewise
Thu May 7 09:24:47 CEST 2009 Daniel Veillard <veillard@redhat.com>
* src/domain_conf.c src/domain_conf.h: parse and save multiple
......
......@@ -1165,6 +1165,11 @@ int virFileWritePid(const char *dir,
FILE *file = NULL;
char *pidfile = NULL;
if (name == NULL || dir == NULL) {
rc = EINVAL;
goto cleanup;
}
if ((rc = virFileMakePath(dir)))
goto cleanup;
......@@ -1212,6 +1217,11 @@ int virFileReadPid(const char *dir,
char *pidfile = NULL;
*pid = 0;
if (name == NULL || dir == NULL) {
rc = EINVAL;
goto cleanup;
}
if (!(pidfile = virFilePid(dir, name))) {
rc = ENOMEM;
goto cleanup;
......@@ -1246,6 +1256,11 @@ int virFileDeletePid(const char *dir,
int rc = 0;
char *pidfile = NULL;
if (name == NULL || dir == NULL) {
rc = EINVAL;
goto cleanup;
}
if (!(pidfile = virFilePid(dir, name))) {
rc = ENOMEM;
goto cleanup;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册