summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith M Wesolowski <wesolows@foobazco.org>2013-11-25 17:26:30 +0000
committerKeith M Wesolowski <wesolows@foobazco.org>2013-11-25 17:26:30 +0000
commit2420528bf5ef57242fc0cc9c40e6277e6b222281 (patch)
tree016d825e2c1fffe7d1ab19f5c453ac7e16eb3c06
parentbb2190248603756dd10f9584729f213edf76577f (diff)
parentc5accfb2728453a874214835d99897e09a0cf3f2 (diff)
downloadillumos-joyent-2420528bf5ef57242fc0cc9c40e6277e6b222281.tar.gz
[illumos-gate merge]
commit c5accfb2728453a874214835d99897e09a0cf3f2 4270 ld(1) argument error reporting is still pretty bad commit 44a646f1952df7a26e3bea7984f7a6c05d45eb0a 4227 ld --library-path is translated to -l-path, not -L commit 7c9adcc5db714f9170fd80006e7c2b613f5b17db 4342 NULL pointer dereference in rfs4_op_setclientid() commit 1daace1d1f6637208174834a98af2c7969517a7b 4194 xargs feedback for -0 not included commit a8039bf395ff9572baeefc76b39d2c3355ebd2d5 4323 NDMP return the wrong error code in NDMP backup policy
-rw-r--r--usr/src/cmd/ndmpd/ndmp/ndmpd_tar3.c21
-rw-r--r--usr/src/cmd/sgs/libld/common/args.c15
-rw-r--r--usr/src/cmd/sgs/libld/common/libld.msg1
-rw-r--r--usr/src/cmd/sgs/libld/common/util.c25
-rw-r--r--usr/src/cmd/sgs/packages/common/SUNWonld-README2
-rw-r--r--usr/src/cmd/xargs/xargs.c3
-rw-r--r--usr/src/uts/common/fs/nfs/nfs4_srv.c22
7 files changed, 61 insertions, 28 deletions
diff --git a/usr/src/cmd/ndmpd/ndmp/ndmpd_tar3.c b/usr/src/cmd/ndmpd/ndmp/ndmpd_tar3.c
index 92d2fcaf09..1419495c18 100644
--- a/usr/src/cmd/ndmpd/ndmp/ndmpd_tar3.c
+++ b/usr/src/cmd/ndmpd/ndmp/ndmpd_tar3.c
@@ -1,5 +1,6 @@
/*
* Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright 2013 Nexenta Systems, Inc. All rights reserved.
*/
/*
@@ -3661,31 +3662,25 @@ ndmp_error
ndmp_backup_get_params_v3(ndmpd_session_t *session,
ndmpd_module_params_t *params)
{
- ndmp_error rv;
ndmp_lbr_params_t *nlp;
if (!session || !params)
return (NDMP_ILLEGAL_ARGS_ERR);
- rv = NDMP_NO_ERR;
nlp = ndmp_get_nlp(session);
if (!nlp) {
MOD_LOGV3(params, NDMP_LOG_ERROR,
"Internal error: NULL nlp.\n");
- rv = NDMP_ILLEGAL_ARGS_ERR;
+ return (NDMP_ILLEGAL_ARGS_ERR);
} else {
- if (!(nlp->nlp_backup_path = get_backup_path_v3(params)))
- rv = NDMP_FILE_NOT_FOUND_ERR;
- else if (!is_valid_backup_dir_v3(params, nlp->nlp_backup_path))
- rv = NDMP_ILLEGAL_ARGS_ERR;
+ if (!(nlp->nlp_backup_path = get_backup_path_v3(params)) ||
+ !is_valid_backup_dir_v3(params, nlp->nlp_backup_path))
+ return (NDMP_ILLEGAL_ARGS_ERR);
}
nlp->nlp_backup_path = get_absolute_path(nlp->nlp_backup_path);
if (!nlp->nlp_backup_path)
- rv = NDMP_FILE_NOT_FOUND_ERR;
-
- if (rv != NDMP_NO_ERR)
- return (rv);
+ return (NDMP_ILLEGAL_ARGS_ERR);
if (fs_is_chkpntvol(nlp->nlp_backup_path) ||
fs_is_rdonly(nlp->nlp_backup_path) ||
@@ -3715,9 +3710,7 @@ ndmp_backup_get_params_v3(ndmpd_session_t *session,
get_exc_env_v3(params, nlp);
get_inc_env_v3(params, nlp);
get_direct_env_v3(params, nlp);
- rv = get_backup_level_v3(params, nlp);
-
- return (rv);
+ return (get_backup_level_v3(params, nlp));
}
diff --git a/usr/src/cmd/sgs/libld/common/args.c b/usr/src/cmd/sgs/libld/common/args.c
index 2b1ad39c54..1080168bbd 100644
--- a/usr/src/cmd/sgs/libld/common/args.c
+++ b/usr/src/cmd/sgs/libld/common/args.c
@@ -1679,8 +1679,19 @@ parseopt_pass1(Ofl_desc *ofl, int argc, char **argv, int *usage)
case '?':
DBG_CALL(Dbg_args_option(ofl->ofl_lml, ndx, c, NULL));
- eprintf(ofl->ofl_lml, ERR_FATAL,
- MSG_INTL(MSG_ARG_UNKNOWN), optopt);
+ /*
+ * If the option character is '-', we're looking at a
+ * long option which couldn't be translated, display a
+ * more useful error.
+ */
+ if (optopt == '-') {
+ eprintf(ofl->ofl_lml, ERR_FATAL,
+ MSG_INTL(MSG_ARG_LONG_UNKNOWN),
+ argv[optind-1]);
+ } else {
+ eprintf(ofl->ofl_lml, ERR_FATAL,
+ MSG_INTL(MSG_ARG_UNKNOWN), optopt);
+ }
(*usage)++;
break;
diff --git a/usr/src/cmd/sgs/libld/common/libld.msg b/usr/src/cmd/sgs/libld/common/libld.msg
index 761a293aed..ea111c0c2f 100644
--- a/usr/src/cmd/sgs/libld/common/libld.msg
+++ b/usr/src/cmd/sgs/libld/common/libld.msg
@@ -932,6 +932,7 @@
@ MSG_ARG_UNSUPPORTED "option %s is no longer supported; ignored"
@ MSG_MARG_ONLY "option %s can only be used with a %s"
@ MSG_ARG_UNKNOWN "unrecognized option '-%c'"
+@ MSG_ARG_LONG_UNKNOWN "unrecognized option '%s'"
@ MSG_ARG_USEHELP "use the -z help option for usage information"
diff --git a/usr/src/cmd/sgs/libld/common/util.c b/usr/src/cmd/sgs/libld/common/util.c
index 7b59734c1d..d9aaed59bc 100644
--- a/usr/src/cmd/sgs/libld/common/util.c
+++ b/usr/src/cmd/sgs/libld/common/util.c
@@ -301,9 +301,9 @@ str2chr_wrap_cb(int c)
}
/*
- * Determine whether this string, possibly with an associated option, should be
- * translated to an option character. If so, update the optind and optarg
- * as described for short options in getopt(3c).
+ * Determine whether this string, possibly with an associated option, should
+ * be translated to an option character. If so, update the optind and optarg
+ * and optopt as described for short options in getopt(3c).
*
* entry:
* lml - Link map list for debug messages
@@ -329,10 +329,11 @@ str2chr(Lm_list *lml, int ndx, int argc, char **argv, char *arg, int c,
if (strcmp(arg, opt) == 0) {
DBG_CALL(Dbg_args_str2chr(lml, ndx, opt, c));
optind += 1;
+ optopt = c;
return (c);
}
-
- } else if (strncmp(arg, opt, optsz) == 0) {
+ } else if ((strcmp(arg, opt) == 0) ||
+ ((arg[optsz] == '=') && strncmp(arg, opt, optsz) == 0)) {
/*
* Otherwise, compare the option name, which may be
* concatenated with the option argument.
@@ -345,15 +346,21 @@ str2chr(Lm_list *lml, int ndx, int argc, char **argv, char *arg, int c,
* Make sure an optarg is available, and if not return
* a failure to prevent any fall-through to the generic
* getopt() processing.
+ *
+ * Since we'll be completely failing this option we
+ * don't want to update optopt with the translation,
+ * but also need to set it to _something_. Setting it
+ * to the '-' of the argument causes us to behave
+ * correctly.
*/
if ((++optind + 1) > argc) {
+ optopt = arg[0];
return ('?');
}
optarg = argv[optind];
optind++;
} else {
/*
- * Optarg concatenated to option (no white space).
* GNU option/option argument pairs can be represented
* with a "=" separator. If this is the case, remove
* the separator.
@@ -361,14 +368,16 @@ str2chr(Lm_list *lml, int ndx, int argc, char **argv, char *arg, int c,
optarg = &arg[optsz];
optind++;
if (*optarg == '=') {
- if (*(++optarg) == '\0')
+ if (*(++optarg) == '\0') {
+ optopt = arg[0];
return ('?');
+ }
}
}
if (cbfunc != NULL)
c = (*cbfunc)(c);
-
+ optopt = c;
return (c);
}
return (0);
diff --git a/usr/src/cmd/sgs/packages/common/SUNWonld-README b/usr/src/cmd/sgs/packages/common/SUNWonld-README
index 71cb2a1743..4ef9326cc8 100644
--- a/usr/src/cmd/sgs/packages/common/SUNWonld-README
+++ b/usr/src/cmd/sgs/packages/common/SUNWonld-README
@@ -1650,3 +1650,5 @@ Bugid Risk Synopsis
3926 multiple extern map file definitions corrupt symbol table entry
3999 libld extended section handling is broken
4003 dldump() can't deal with extended sections
+4227 ld --library-path is translated to -l-path, not -L
+4270 ld(1) argument error reporting is still pretty bad
diff --git a/usr/src/cmd/xargs/xargs.c b/usr/src/cmd/xargs/xargs.c
index 33ba01f3ea..e50c7d6d45 100644
--- a/usr/src/cmd/xargs/xargs.c
+++ b/usr/src/cmd/xargs/xargs.c
@@ -129,7 +129,7 @@ static char **mav; /* modified argv, after parsing */
static int n_inserts; /* # of insertions. */
/* our usage message: */
-#define USAGEMSG "Usage: xargs: [-t] [-p] [-e[eofstr]] [-E eofstr] "\
+#define USAGEMSG "Usage: xargs: [-t] [-p] [-0] [-e[eofstr]] [-E eofstr] "\
"[-I replstr] [-i[replstr]] [-L #] [-l[#]] [-n # [-x]] [-s size] "\
"[cmd [args ...]]\n"
@@ -1020,6 +1020,7 @@ process_special:
case 'p' :
case 't' :
case 'x' :
+ case '0' :
break;
case '-' :
diff --git a/usr/src/uts/common/fs/nfs/nfs4_srv.c b/usr/src/uts/common/fs/nfs/nfs4_srv.c
index d576ec9e0a..7cc71954b1 100644
--- a/usr/src/uts/common/fs/nfs/nfs4_srv.c
+++ b/usr/src/uts/common/fs/nfs/nfs4_srv.c
@@ -20,8 +20,8 @@
*/
/*
* Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
- * Copyright 2013 Nexenta Systems, Inc. All rights reserved.
* Copyright (c) 2012 by Delphix. All rights reserved.
+ * Copyright 2013 Nexenta Systems, Inc. All rights reserved.
*/
/*
@@ -7925,6 +7925,22 @@ out:
OPEN_DOWNGRADE4res *, resp);
}
+static void *
+memstr(const void *s1, const char *s2, size_t n)
+{
+ size_t l = strlen(s2);
+ char *p = (char *)s1;
+
+ while (n >= l) {
+ if (bcmp(p, s2, l) == 0)
+ return (p);
+ p++;
+ n--;
+ }
+
+ return (NULL);
+}
+
/*
* The logic behind this function is detailed in the NFSv4 RFC in the
* SETCLIENTID operation description under IMPLEMENTATION. Refer to
@@ -7957,8 +7973,8 @@ retry:
/*
* Record if it is a Solaris client that cannot handle referrals.
*/
- if (strstr(args->client.id_val, "Solaris") &&
- !strstr(args->client.id_val, "+referrals")) {
+ if (memstr(args->client.id_val, "Solaris", args->client.id_len) &&
+ !memstr(args->client.id_val, "+referrals", args->client.id_len)) {
/* Add a "yes, it's downrev" record */
create = TRUE;
ci = rfs4_find_clntip(args->client.cl_addr, &create);