From: Ken Brush <ken@cgi101.com>
To: linux-hotplug@vger.kernel.org
Subject: [PATCH] make cmdline options permanent
Date: Fri, 05 Mar 2004 09:08:52 +0000 [thread overview]
Message-ID: <200403050108.52966.ken@cgi101.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 374 bytes --]
I noticed this behavior in scsi_id and it was listed in the TODO as:
- Document that config file options override command line options, or fix
the code. This means a '-b' in the config file disables any -g on the
command line.
I chose to fix the code. Though, it appears to be a non-elegant solution to
me, it seemed the least intrusive into the existing code.
-Ken
[-- Attachment #2: scsi_id.patch --]
[-- Type: text/x-diff, Size: 1054 bytes --]
--- udev-021.orig/extras/scsi_id/scsi_id.c 2004-03-02 16:01:31.000000000 -0800
+++ udev-021/extras/scsi_id/scsi_id.c 2004-03-05 00:58:46.438876291 -0800
@@ -58,6 +58,10 @@
*/
static const char dev_short_options[] = "bgp:";
+/* cmdline options */
+static char cmdline_options[sizeof(short_options)];
+static int cmdline;
+
char sysfs_mnt_path[SYSFS_PATH_MAX];
static int all_good;
@@ -421,9 +425,17 @@
else
dprintf("option '%c'\n", option);
+ /* Store the option */
+ if(cmdline == 0)
+ cmdline_options[strlen(cmdline_options)] = option;
+
switch (option) {
case 'b':
+ if((cmdline == 0) ||
+ (cmdline == 1 &&
+ strchr(cmdline_options,'b') != NULL))
all_good = 0;
+
break;
case 'c':
@@ -444,6 +456,9 @@
break;
case 'g':
+ if((cmdline == 0) ||
+ (cmdline == 1 &&
+ strchr(cmdline_options,'g') != NULL))
all_good = 1;
break;
@@ -486,6 +501,8 @@
return -1;
}
}
+ /* set cmdline to prevent squashing of the cmdline options */
+ cmdline = 1;
return 0;
}
reply other threads:[~2004-03-05 9:08 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200403050108.52966.ken@cgi101.com \
--to=ken@cgi101.com \
--cc=linux-hotplug@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).