src/host_id.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-)
New commits: commit f6e5d72a37c52fb29ee57e50fb011fa66ccd4d79 Author: David Teigland teigland@redhat.com Date: Wed Apr 13 13:15:23 2011 -0500
sanlock: check lockspace name and host_id
diff --git a/src/host_id.c b/src/host_id.c index 535307e..8c8056a 100644 --- a/src/host_id.c +++ b/src/host_id.c @@ -289,6 +289,18 @@ int add_space(struct space *sp) { int rv, result;
+ if (!sp->name[0]) { + log_erros(sp, "add_space no name"); + rv = -EINVAL; + goto fail; + } + + if (!sp->host_id) { + log_erros(sp, "add_space zero host_id"); + rv = -EINVAL; + goto fail; + } + if (space_exists(sp->space_name, &sp->host_id_disk, sp->host_id)) { log_erros(sp, "add_space exists"); rv = -EEXIST; @@ -305,7 +317,7 @@ int add_space(struct space *sp) if (rv != 1) { log_erros(sp, "add_space open_disk failed %d %s", rv, sp->host_id_disk.path); - rv = -1; + rv = -ENODEV; goto fail; }
sanlock-devel@lists.fedorahosted.org