diff options
author | H. Peter Anvin <hpa@zytor.com> | 2004-01-15 01:40:56 +0000 |
---|---|---|
committer | H. Peter Anvin <hpa@zytor.com> | 2004-01-15 01:40:56 +0000 |
commit | bc8576d111e17fe4c398df453085a94b06451821 (patch) | |
tree | 7ec3ca293e9dbf024749257f9ba9851e435da1fe /modules | |
parent | a69acf82bacf09e2a84ec146491c6dc5c70d5554 (diff) | |
download | autofs3-bc8576d111e17fe4c398df453085a94b06451821.tar.gz autofs3-bc8576d111e17fe4c398df453085a94b06451821.tar.xz autofs3-bc8576d111e17fe4c398df453085a94b06451821.zip |
Cleanup crap in the multimount module
Diffstat (limited to 'modules')
-rw-r--r-- | modules/lookup_multi.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/modules/lookup_multi.c b/modules/lookup_multi.c index 4fcbf6d..062e4d7 100644 --- a/modules/lookup_multi.c +++ b/modules/lookup_multi.c @@ -53,6 +53,7 @@ int lookup_init(const char *my_mapfmt, int argc, const char * const *argv, if ( !(*context = ctxt = malloc(sizeof(struct lookup_context))) ) goto nomem; + memset(ctxt, 0, sizeof(struct lookup_context)); if ( argc < 1 ) { syslog(LOG_CRIT, MODPREFIX "No map list"); @@ -65,20 +66,20 @@ int lookup_init(const char *my_mapfmt, int argc, const char * const *argv, } if ( !(ctxt->m = malloc(ctxt->n*sizeof(struct module_info))) || - !(ctxt->argl = malloc((argc+1)*sizeof(const char **))) ) + !(ctxt->argl = malloc((argc+1)*sizeof(const char *))) ) goto nomem; + memset(ctxt->m, 0, ctxt->n*sizeof(struct module_info)); - memcpy(ctxt->argl, argv, (argc+1)*sizeof(const char **)); + memcpy(ctxt->argl, argv, (argc+1)*sizeof(const char *)); - for ( i = j = an = 0 ; argv[an] ; an++ ) { - if ( j == 0 ) + for ( i = j = an = 0 ; ctxt->argl[an] ; an++ ) { + if ( ctxt->m[i].argc == 0 ) ctxt->m[i].argv = &ctxt->argl[an]; if ( !strcmp(ctxt->argl[an], "--") ) { ctxt->argl[an] = NULL; - i++; j = 0; + i++; } else { ctxt->m[i].argc++; - j++; } } @@ -96,7 +97,8 @@ int lookup_init(const char *my_mapfmt, int argc, const char * const *argv, if ( !(ctxt->m[i].mod = open_lookup(map, MODPREFIX, mapfmt ? mapfmt : my_mapfmt, - ctxt->m[i].argc, ctxt->m[i].argv)) ) + ctxt->m[i].argc - 1, + ctxt->m[i].argv + 1)) ) return 1; } |