[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
[libvirt] [PATCH] return a sensible error on bogus paths
- From: Guido Günther <agx sigxcpu org>
- To: libvir-list redhat com
- Subject: [libvirt] [PATCH] return a sensible error on bogus paths
- Date: Mon, 4 May 2009 21:40:33 +0200
Hi,
attached patch makes it easier to detect bogus paths when
creating/removing pidfiles. O.k. to apply?
Cheers,
-- Guido
>From f79fcd99b28e36cbb80bd91ac52109148eafa814 Mon Sep 17 00:00:00 2001
From: =?utf-8?q?Guido=20G=C3=BCnther?= <agx sigxcpu org>
Date: Mon, 4 May 2009 21:31:57 +0200
Subject: [PATCH] return EINVAL on dir == NULL || name == NULL
---
src/util.c | 15 +++++++++++++++
1 files changed, 15 insertions(+), 0 deletions(-)
diff --git a/src/util.c b/src/util.c
index 47a1cd3..c5edc9d 100644
--- a/src/util.c
+++ b/src/util.c
@@ -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;
--
1.6.2.4
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]