summaryrefslogtreecommitdiffstats
path: root/usr.sbin
diff options
context:
space:
mode:
authortrasz <trasz@FreeBSD.org>2015-05-21 13:25:28 +0000
committertrasz <trasz@FreeBSD.org>2015-05-21 13:25:28 +0000
commit938b0cc7dd64a0e7b911f6a093f33e93e1f6c222 (patch)
tree399556006e5c32c6167635ea9bac1059ea81f96e /usr.sbin
parentc0941dd28e1fec3ca4e1c782afa4ce3817817a40 (diff)
downloadFreeBSD-src-938b0cc7dd64a0e7b911f6a093f33e93e1f6c222.zip
FreeBSD-src-938b0cc7dd64a0e7b911f6a093f33e93e1f6c222.tar.gz
MFC r279813:
Make things more readable; no functional changes. Sponsored by: The FreeBSD Foundation
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/autofs/automount.c6
-rw-r--r--usr.sbin/autofs/automountd.c20
-rw-r--r--usr.sbin/autofs/common.c8
-rw-r--r--usr.sbin/autofs/common.h2
-rw-r--r--usr.sbin/autofs/popen.c2
5 files changed, 16 insertions, 22 deletions
diff --git a/usr.sbin/autofs/automount.c b/usr.sbin/autofs/automount.c
index 3c59704..0c42ffd 100644
--- a/usr.sbin/autofs/automount.c
+++ b/usr.sbin/autofs/automount.c
@@ -349,8 +349,7 @@ main_automount(int argc, char **argv)
if (options == NULL) {
options = checked_strdup(optarg);
} else {
- options =
- separated_concat(options, optarg, ',');
+ options = concat(options, ',', optarg);
}
break;
case 'u':
@@ -388,8 +387,7 @@ main_automount(int argc, char **argv)
if (show_maps) {
if (options != NULL) {
- root->n_options = separated_concat(options,
- root->n_options, ',');
+ root->n_options = concat(options, ',', root->n_options);
}
if (show_maps > 1) {
node_expand_indirect_maps(root);
diff --git a/usr.sbin/autofs/automountd.c b/usr.sbin/autofs/automountd.c
index ff60a99..75c6a44 100644
--- a/usr.sbin/autofs/automountd.c
+++ b/usr.sbin/autofs/automountd.c
@@ -241,8 +241,7 @@ handle_request(const struct autofs_daemon_request *adr, char *cmdline_options,
* Prepend options passed via automountd(8) command line.
*/
if (cmdline_options != NULL) {
- options =
- separated_concat(cmdline_options, options, ',');
+ options = concat(cmdline_options, ',', options);
}
nobrowse = pick_option("nobrowse", &options);
@@ -268,8 +267,7 @@ handle_request(const struct autofs_daemon_request *adr, char *cmdline_options,
* We still need to create the single subdirectory
* user is trying to access.
*/
- tmp = separated_concat(adr->adr_path,
- adr->adr_key, '/');
+ tmp = concat(adr->adr_path, '/', adr->adr_key);
node = node_find(root, tmp);
if (node != NULL)
create_subtree(node, false);
@@ -301,12 +299,12 @@ handle_request(const struct autofs_daemon_request *adr, char *cmdline_options,
* Prepend options passed via automountd(8) command line.
*/
if (cmdline_options != NULL)
- options = separated_concat(cmdline_options, options, ',');
+ options = concat(cmdline_options, ',', options);
/*
* Append "automounted".
*/
- options = separated_concat(options, "automounted", ',');
+ options = concat(options, ',', "automounted");
/*
* Remove "nobrowse", mount(8) doesn't understand it.
@@ -334,11 +332,10 @@ handle_request(const struct autofs_daemon_request *adr, char *cmdline_options,
if (retrycnt == NULL) {
log_debugx("retrycnt not specified in options; "
"defaulting to 1");
- options = separated_concat(options,
- separated_concat("retrycnt", "1", '='), ',');
+ options = concat(options, ',', "retrycnt=1");
} else {
- options = separated_concat(options,
- separated_concat("retrycnt", retrycnt, '='), ',');
+ options = concat(options, ',',
+ concat("retrycnt", '=', retrycnt));
}
}
@@ -465,8 +462,7 @@ main_automountd(int argc, char **argv)
if (options == NULL) {
options = checked_strdup(optarg);
} else {
- options =
- separated_concat(options, optarg, ',');
+ options = concat(options, ',', optarg);
}
break;
case 'v':
diff --git a/usr.sbin/autofs/common.c b/usr.sbin/autofs/common.c
index 395838d..51dd552 100644
--- a/usr.sbin/autofs/common.c
+++ b/usr.sbin/autofs/common.c
@@ -89,7 +89,7 @@ checked_strdup(const char *s)
* Concatenate two strings, inserting separator between them, unless not needed.
*/
char *
-separated_concat(const char *s1, const char *s2, char separator)
+concat(const char *s1, char separator, const char *s2)
{
char *result;
int ret;
@@ -135,7 +135,7 @@ create_directory(const char *path)
component = strsep(&copy, "/");
if (component == NULL)
break;
- tmp = separated_concat(partial, component, '/');
+ tmp = concat(partial, '/', component);
free(partial);
partial = tmp;
//log_debugx("creating \"%s\"", partial);
@@ -545,7 +545,7 @@ node_path_x(const struct node *n, char *x)
}
assert(n->n_key[0] != '\0');
- path = separated_concat(n->n_key, x, '/');
+ path = concat(n->n_key, '/', x);
free(x);
return (node_path_x(n->n_parent, path));
@@ -581,7 +581,7 @@ node_options_x(const struct node *n, char *x)
if (n == NULL)
return (x);
- options = separated_concat(x, n->n_options, ',');
+ options = concat(x, ',', n->n_options);
free(x);
return (node_options_x(n->n_parent, options));
diff --git a/usr.sbin/autofs/common.h b/usr.sbin/autofs/common.h
index 16a8d73..686a89d 100644
--- a/usr.sbin/autofs/common.h
+++ b/usr.sbin/autofs/common.h
@@ -70,7 +70,7 @@ void log_warnx(const char *, ...) __printflike(1, 2);
void log_debugx(const char *, ...) __printf0like(1, 2);
char *checked_strdup(const char *);
-char *separated_concat(const char *s1, const char *s2, char separator);
+char *concat(const char *s1, char separator, const char *s2);
void create_directory(const char *path);
struct node *node_new_root(void);
diff --git a/usr.sbin/autofs/popen.c b/usr.sbin/autofs/popen.c
index 6cd964d..e114880 100644
--- a/usr.sbin/autofs/popen.c
+++ b/usr.sbin/autofs/popen.c
@@ -104,7 +104,7 @@ auto_popen(const char *argv0, ...)
if (arg == NULL)
break;
- command = separated_concat(command, arg, ' ');
+ command = concat(command, ' ', arg);
}
va_end(ap);
OpenPOWER on IntegriCloud