svn commit: r216722 - head/sbin/hastd

Pawel Jakub Dawidek pjd at FreeBSD.org
Sun Dec 26 19:08:41 UTC 2010


Author: pjd
Date: Sun Dec 26 19:08:41 2010
New Revision: 216722
URL: http://svn.freebsd.org/changeset/base/216722

Log:
  Detect when resource is configured more than once.
  
  MFC after:	3 days

Modified:
  head/sbin/hastd/parse.y

Modified: head/sbin/hastd/parse.y
==============================================================================
--- head/sbin/hastd/parse.y	Sun Dec 26 19:07:58 2010	(r216721)
+++ head/sbin/hastd/parse.y	Sun Dec 26 19:08:41 2010	(r216722)
@@ -535,6 +535,16 @@ resource_statement:	RESOURCE resource_st
 
 resource_start:	STR
 	{
+		/* Check if there is no duplicate entry. */
+		TAILQ_FOREACH(curres, &lconfig->hc_resources, hr_next) {
+			if (strcmp(curres->hr_name, $1) == 0) {
+				pjdlog_error("Resource %s configured more than once.",
+				    curres->hr_name);
+				free($1);
+				return (1);
+			}
+		}
+
 		/*
 		 * Clear those, so we can tell if they were set at
 		 * resource-level or not.


More information about the svn-src-all mailing list