Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 12 Mar 2015 12:17:16 +0000 (UTC)
From:      Edward Tomasz Napierala <trasz@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r279915 - head/usr.sbin/autofs
Message-ID:  <201503121217.t2CCHG2f065060@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: trasz
Date: Thu Mar 12 12:17:15 2015
New Revision: 279915
URL: https://svnweb.freebsd.org/changeset/base/279915

Log:
  Make concat() accept NULL arguments.
  
  MFC after:	1 month
  Sponsored by:	The FreeBSD Foundation

Modified:
  head/usr.sbin/autofs/automount.c
  head/usr.sbin/autofs/automountd.c
  head/usr.sbin/autofs/common.c

Modified: head/usr.sbin/autofs/automount.c
==============================================================================
--- head/usr.sbin/autofs/automount.c	Thu Mar 12 12:14:11 2015	(r279914)
+++ head/usr.sbin/autofs/automount.c	Thu Mar 12 12:17:15 2015	(r279915)
@@ -345,11 +345,7 @@ main_automount(int argc, char **argv)
 			force_unmount = true;
 			break;
 		case 'o':
-			if (options == NULL) {
-				options = checked_strdup(optarg);
-			} else {
-				options = concat(options, ',', optarg);
-			}
+			options = concat(options, ',', optarg);
 			break;
 		case 'u':
 			do_unmount = true;
@@ -385,9 +381,7 @@ main_automount(int argc, char **argv)
 	parse_master(root, AUTO_MASTER_PATH);
 
 	if (show_maps) {
-		if (options != NULL) {
-			root->n_options = concat(options, ',', root->n_options);
-		}
+		root->n_options = concat(options, ',', root->n_options);
 		if (show_maps > 1) {
 			node_expand_indirect_maps(root);
 			node_expand_ampersand(root, NULL);

Modified: head/usr.sbin/autofs/automountd.c
==============================================================================
--- head/usr.sbin/autofs/automountd.c	Thu Mar 12 12:14:11 2015	(r279914)
+++ head/usr.sbin/autofs/automountd.c	Thu Mar 12 12:17:15 2015	(r279915)
@@ -241,8 +241,7 @@ handle_request(const struct autofs_daemo
 	/*
 	 * Prepend options passed via automountd(8) command line.
 	 */
-	if (cmdline_options != NULL)
-		options = concat(cmdline_options, ',', options);
+	options = concat(cmdline_options, ',', options);
 
 	if (node->n_location == NULL) {
 		log_debugx("found node defined at %s:%d; not a mountpoint",
@@ -455,11 +454,7 @@ main_automountd(int argc, char **argv)
 			maxproc = atoi(optarg);
 			break;
 		case 'o':
-			if (options == NULL) {
-				options = checked_strdup(optarg);
-			} else {
-				options = concat(options, ',', optarg);
-			}
+			options = concat(options, ',', optarg);
 			break;
 		case 'v':
 			debug++;

Modified: head/usr.sbin/autofs/common.c
==============================================================================
--- head/usr.sbin/autofs/common.c	Thu Mar 12 12:14:11 2015	(r279914)
+++ head/usr.sbin/autofs/common.c	Thu Mar 12 12:17:15 2015	(r279915)
@@ -94,8 +94,10 @@ concat(const char *s1, char separator, c
 	char *result;
 	int ret;
 
-	assert(s1 != NULL);
-	assert(s2 != NULL);
+	if (s1 == NULL)
+		s1 = "";
+	if (s2 == NULL)
+		s2 = "";
 
 	/*
 	 * If s2 starts with separator - skip it; otherwise concatenating



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