Fix the default skip-compress list.
authorWayne Davison <wayned@samba.org>
Wed, 8 Apr 2020 01:08:05 +0000 (18:08 -0700)
committerWayne Davison <wayned@samba.org>
Wed, 8 Apr 2020 01:15:09 +0000 (18:15 -0700)
The default value of the skip-compress list actually comes from the
daemon's default lp_dont_compress() value, but a while back the vars
stopped getting default values in a non-daemon run. I added a call to
reset_daemon_vars() so that the "Vars" values get set from "Defaults".

loadparm.c
main.c

index 029f358fe0ae9fbe0d7050a2ff882ec4f45e1c2f..534e7b63f892469e2dfe282518086230a255d110 100644 (file)
@@ -449,7 +449,7 @@ static struct parm_struct parm_table[] =
 };
 
 /* Initialise the Default all_vars structure. */
-static void reset_all_vars(void)
+void reset_daemon_vars(void)
 {
        memcpy(&Vars, &Defaults, sizeof Vars);
 }
@@ -872,7 +872,7 @@ int lp_load(char *pszFname, int globals_only)
 {
        bInGlobalSection = True;
 
-       reset_all_vars();
+       reset_daemon_vars();
 
        /* We get sections first, so have to start 'behind' to make up. */
        iSectionIndex = -1;
diff --git a/main.c b/main.c
index 1328c504098760a9b959a6e2395ee6cc16be0de6..9af9e5d3efd4d5f6cfb65bd4f2430dd83c5c23cf 100644 (file)
--- a/main.c
+++ b/main.c
@@ -1681,6 +1681,10 @@ int main(int argc,char *argv[])
 
        memset(&stats, 0, sizeof(stats));
 
+       /* Even a non-daemon runs needs the default config values to be set, e.g.
+        * lp_dont_compress() is queried when no --skip-compress option is set. */
+       reset_daemon_vars();
+
        if (argc < 2) {
                usage(FERROR);
                exit_cleanup(RERR_SYNTAX);