* [PATCH] make cmdline options permanent
@ 2004-03-05 9:08 Ken Brush
0 siblings, 0 replies; only message in thread
From: Ken Brush @ 2004-03-05 9:08 UTC (permalink / raw)
To: linux-hotplug
[-- 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;
}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2004-03-05 9:08 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-03-05 9:08 [PATCH] make cmdline options permanent Ken Brush
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).