Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 26 Dec 2010 19:08:41 +0000 (UTC)
From:      Pawel Jakub Dawidek <pjd@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r216722 - head/sbin/hastd
Message-ID:  <201012261908.oBQJ8fjC096838@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201012261908.oBQJ8fjC096838>