aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael K. Johnson <johnsonm@redhat.com>1997-09-16 18:35:46 +0000
committerMichael K. Johnson <johnsonm@redhat.com>1997-09-16 18:35:46 +0000
commit2371f5e29eebbd71c2970998dabbfaf500d59a3c (patch)
treea493d84b3f832f8f2ff38588cdcd8c400cf1fa42
parent15bb4512255d2790567231b99c54a45a98644d71 (diff)
downloadinitscripts-2371f5e29eebbd71c2970998dabbfaf500d59a3c.tar
initscripts-2371f5e29eebbd71c2970998dabbfaf500d59a3c.tar.gz
initscripts-2371f5e29eebbd71c2970998dabbfaf500d59a3c.tar.bz2
initscripts-2371f5e29eebbd71c2970998dabbfaf500d59a3c.tar.xz
initscripts-2371f5e29eebbd71c2970998dabbfaf500d59a3c.zip
Users are not required to specify the "ifcfg-" part of the config file name.
-rw-r--r--src/usernetctl.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/usernetctl.c b/src/usernetctl.c
index 1139a8c5..040aa2c9 100644
--- a/src/usernetctl.c
+++ b/src/usernetctl.c
@@ -88,6 +88,16 @@ int main(int argc, char ** argv) {
ifaceConfig = chptr + 1;
chptr++;
}
+
+ /* automatically prepend "ifcfg-" if it is not specified */
+ if (!strncmp(ifaceConfig, "ifcfg-", 6)) {
+ char *temp;
+ temp = (char *) malloc(strlen(ifaceConfig) + 6);
+ strcpy(temp, "ifcfg-");
+ /* strcat is safe because we got the length from strlen */
+ strcat(temp, ifaceConfig);
+ ifaceConfig = temp;
+ }
/* these shouldn't be symbolic links -- anal, but that's fine w/ me */
if (lstat(ifaceConfig, &sb)) {