mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-08-27 02:51:16 +00:00
check for NULL pointers in pidfile functions
This commit is contained in:
parent
7ee54d8356
commit
1dfc35677e
@ -1,3 +1,10 @@
|
|||||||
|
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>
|
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
|
* src/domain_conf.c src/domain_conf.h: parse and save multiple
|
||||||
|
15
src/util.c
15
src/util.c
@ -1165,6 +1165,11 @@ int virFileWritePid(const char *dir,
|
|||||||
FILE *file = NULL;
|
FILE *file = NULL;
|
||||||
char *pidfile = NULL;
|
char *pidfile = NULL;
|
||||||
|
|
||||||
|
if (name == NULL || dir == NULL) {
|
||||||
|
rc = EINVAL;
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
|
||||||
if ((rc = virFileMakePath(dir)))
|
if ((rc = virFileMakePath(dir)))
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
@ -1212,6 +1217,11 @@ int virFileReadPid(const char *dir,
|
|||||||
char *pidfile = NULL;
|
char *pidfile = NULL;
|
||||||
*pid = 0;
|
*pid = 0;
|
||||||
|
|
||||||
|
if (name == NULL || dir == NULL) {
|
||||||
|
rc = EINVAL;
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
|
||||||
if (!(pidfile = virFilePid(dir, name))) {
|
if (!(pidfile = virFilePid(dir, name))) {
|
||||||
rc = ENOMEM;
|
rc = ENOMEM;
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
@ -1246,6 +1256,11 @@ int virFileDeletePid(const char *dir,
|
|||||||
int rc = 0;
|
int rc = 0;
|
||||||
char *pidfile = NULL;
|
char *pidfile = NULL;
|
||||||
|
|
||||||
|
if (name == NULL || dir == NULL) {
|
||||||
|
rc = EINVAL;
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
|
||||||
if (!(pidfile = virFilePid(dir, name))) {
|
if (!(pidfile = virFilePid(dir, name))) {
|
||||||
rc = ENOMEM;
|
rc = ENOMEM;
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
Loading…
Reference in New Issue
Block a user