[Ocfs2-tools-commits] mfasheh commits r596 - trunk/libo2dlm

svn-commits at oss.oracle.com svn-commits at oss.oracle.com
Wed Jan 26 13:53:37 CST 2005


Author: mfasheh
Date: 2005-01-26 13:53:35 -0600 (Wed, 26 Jan 2005)
New Revision: 596

Modified:
   trunk/libo2dlm/o2dlm.c
   trunk/libo2dlm/o2dlm_err.et.in
Log:
* Check arguments more thoroughly



Modified: trunk/libo2dlm/o2dlm.c
===================================================================
--- trunk/libo2dlm/o2dlm.c	2005-01-26 19:53:08 UTC (rev 595)
+++ trunk/libo2dlm/o2dlm.c	2005-01-26 19:53:35 UTC (rev 596)
@@ -176,6 +176,9 @@
 	errcode_t ret, dir_created = 0;
 	struct o2dlm_ctxt *ctxt;
 
+	if (!dlmfs_path || !domain_name || !dlm_ctxt)
+		return O2DLM_ET_INVALID_ARGS;
+
 	if (strlen(domain_name) >= O2DLM_DOMAIN_MAX_LEN)
 		return O2DLM_ET_NAME_TOO_LONG;
 
@@ -307,6 +310,9 @@
 	char *path;
 	struct o2dlm_lock_res *lockres;
 
+	if (!ctxt || !lockid)
+		return O2DLM_ET_INVALID_ARGS;
+
 	/* names starting with '.' are reserved. */
 	if (lockid[0] == '.')
 		return O2DLM_ET_INVALID_LOCK_NAME;
@@ -396,6 +402,9 @@
 	int ret;
 	struct o2dlm_lock_res *lockres = NULL;
 
+	if (!ctxt || !lockid)
+		return O2DLM_ET_INVALID_ARGS;
+
 	lockres = o2dlm_find_lock_res(ctxt, lockid);
 	if (!lockres)
 		return O2DLM_ET_UNKNOWN_LOCK;
@@ -466,6 +475,9 @@
 	struct o2dlm_lock_res *lockres;
         struct list_head *p, *n;
 
+	if (!ctxt)
+		return O2DLM_ET_INVALID_ARGS;
+
 	list_for_each_safe(p, n, &ctxt->ct_locks) {
 		lockres = list_entry(p, struct o2dlm_lock_res, l_list);
 		list_del(&lockres->l_list);

Modified: trunk/libo2dlm/o2dlm_err.et.in
===================================================================
--- trunk/libo2dlm/o2dlm_err.et.in	2005-01-26 19:53:08 UTC (rev 595)
+++ trunk/libo2dlm/o2dlm_err.et.in	2005-01-26 19:53:35 UTC (rev 596)
@@ -90,4 +90,7 @@
 ec	O2DLM_ET_FAILED_UNLOCKS,
 	"Could not drop all locks"
 
+ec	O2DLM_ET_INVALID_ARGS,
+	"Invalid arguments passed to function"
+
 	end



More information about the Ocfs2-tools-commits mailing list