diff options
author | Garming Sam <garming@catalyst.net.nz> | 2014-02-20 11:01:52 +1300 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2014-05-07 19:49:15 +0200 |
commit | 61103e1a469b4d589b139ce8bdcc1766dc2dd36e (patch) | |
tree | a357cdae5f82492ba95cf4cfe85f422e3f71f1bc /lib/param/loadparm.c | |
parent | a62b655558b62d7cb6c6522dba68e8e88e2ef9ca (diff) | |
download | samba-61103e1a469b4d589b139ce8bdcc1766dc2dd36e.tar.gz samba-61103e1a469b4d589b139ce8bdcc1766dc2dd36e.tar.xz samba-61103e1a469b4d589b139ce8bdcc1766dc2dd36e.zip |
param: use a single add_to_file_list method
Signed-off-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Diffstat (limited to 'lib/param/loadparm.c')
-rw-r--r-- | lib/param/loadparm.c | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/lib/param/loadparm.c b/lib/param/loadparm.c index ef46a54b153..d5b8d2c10bd 100644 --- a/lib/param/loadparm.c +++ b/lib/param/loadparm.c @@ -1006,10 +1006,10 @@ static bool lpcfg_service_ok(struct loadparm_service *service) it's date and needs to be reloaded. ********************************************************************/ -static void add_to_file_list(TALLOC_CTX *mem_ctx, struct file_lists **file, +void add_to_file_list(TALLOC_CTX *mem_ctx, struct file_lists **list, const char *fname, const char *subfname) { - struct file_lists *f = *file; + struct file_lists *f = *list; while (f) { if (f->name && !strcmp(f->name, fname)) @@ -1020,25 +1020,30 @@ static void add_to_file_list(TALLOC_CTX *mem_ctx, struct file_lists **file, if (!f) { f = talloc(mem_ctx, struct file_lists); if (!f) - return; - f->next = *file; + goto fail; + f->next = *list; f->name = talloc_strdup(f, fname); if (!f->name) { - talloc_free(f); - return; + TALLOC_FREE(f); + goto fail; } f->subfname = talloc_strdup(f, subfname); if (!f->subfname) { - talloc_free(f); - return; + TALLOC_FREE(f); + goto fail; } - *file = f; + *list = f; f->modtime = file_modtime(subfname); } else { time_t t = file_modtime(subfname); if (t) f->modtime = t; } + return; + +fail: + DEBUG(0, ("Unable to add file to file list: %s\n", fname)); + } /******************************************************************* |