summaryrefslogtreecommitdiff
path: root/usr/src/cmd/getmajor
diff options
context:
space:
mode:
authoreota <none@none>2006-09-26 14:29:13 -0700
committereota <none@none>2006-09-26 14:29:13 -0700
commit1ca932730d3439e527d5fe4a15444600d0df7e7e (patch)
tree021f725c3677f6b8619e3ef76fb7720c121e0520 /usr/src/cmd/getmajor
parent23b5c241225a8ade2b6b9f06ebb891ee459e3b02 (diff)
downloadillumos-joyent-1ca932730d3439e527d5fe4a15444600d0df7e7e.tar.gz
6311701 /etc/minor_perm is ignored if it contains comments
6459253 i.nametomajor holds the obsolete shell function 6460892 add_drv and update_drv can accept the invalid names 6462571 should clean up duplicate code in update_minor_entry()
Diffstat (limited to 'usr/src/cmd/getmajor')
-rw-r--r--usr/src/cmd/getmajor/getmajor.sh18
1 files changed, 9 insertions, 9 deletions
diff --git a/usr/src/cmd/getmajor/getmajor.sh b/usr/src/cmd/getmajor/getmajor.sh
index 0796787aeb..2975f9c40d 100644
--- a/usr/src/cmd/getmajor/getmajor.sh
+++ b/usr/src/cmd/getmajor/getmajor.sh
@@ -3,9 +3,8 @@
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or http://www.opensolaris.org/os/licensing.
@@ -21,10 +20,9 @@
# CDDL HEADER END
#
+# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+# Use is subject to license terms.
#
-# Copyright (c) 1991, Sun Microsystems Inc.
-#
-
#ident "%Z%%M% %I% %E% SMI"
if [ $# -ne 1 ]
@@ -33,6 +31,8 @@ then
exit 2
fi
-exec awk -e "BEGIN {found = 0}
-/^$1[ ]/ {print \$2; found = 1; exit 0}
-END {if (found == 0) exit 1}" </etc/name_to_major
+exec nawk -v a="$1" -v del='#' '$1 !~ /^#|^$/ && $1 == a { \
+ num = split($2, maj, del); \
+ if (num > 1) { print maj[1] } else { print $2 } \
+ found = 1; exit 0 } \
+ END {if (!found) exit 1}' < /etc/name_to_major