Pleaaaase check Makefile changes with non-default values. SYSTEM_DB remnants removed - use PER_MACHINE_DIRECTORY now sync
authorKrista 'DarthMama' Bennett <krista@pep.foundation>
Thu, 26 Sep 2019 09:37:41 +0200
branchsync
changeset 4089b3a067ff79f5
parent 4088 e2c8679a8bca
child 4090 07bab7691fbf
Pleaaaase check Makefile changes with non-default values. SYSTEM_DB remnants removed - use PER_MACHINE_DIRECTORY now
db/Makefile
src/Makefile
src/platform_unix.c
     1.1 --- a/db/Makefile	Wed Sep 25 13:01:01 2019 +0200
     1.2 +++ b/db/Makefile	Thu Sep 26 09:37:41 2019 +0200
     1.3 @@ -18,8 +18,8 @@
     1.4  
     1.5  .PHONY: install
     1.6  install: system.db
     1.7 -	mkdir -p `dirname $(SYSTEM_DB)`
     1.8 -	cp system.db $(SYSTEM_DB)
     1.9 +	mkdir -p $(PER_MACHINE_DIRECTORY)
    1.10 +	cp system.db $(PER_MACHINE_DIRECTORY)
    1.11  
    1.12  .PHONY: clean
    1.13  clean:
     2.1 --- a/src/Makefile	Wed Sep 25 13:01:01 2019 +0200
     2.2 +++ b/src/Makefile	Thu Sep 26 09:37:41 2019 +0200
     2.3 @@ -10,7 +10,7 @@
     2.4  endif
     2.5  
     2.6  ifdef PER_MACHINE_DIRECTORY
     2.7 -	EXTRA_MACROS+= -DPER_MACHINE_DIRECTORY=$(PER_MACHINE_DIRECTORY)
     2.8 +	EXTRA_MACROS+= -DPER_MACHINE_DIRECTORY=\"$(PER_MACHINE_DIRECTORY)\"
     2.9  endif
    2.10  
    2.11  CFLAGS+= $(ETPAN_INC) $(PEP_MIME_INC) -I../asn.1 $(EXTRA_MACROS)
     3.1 --- a/src/platform_unix.c	Wed Sep 25 13:01:01 2019 +0200
     3.2 +++ b/src/platform_unix.c	Thu Sep 26 09:37:41 2019 +0200
     3.3 @@ -305,11 +305,25 @@
     3.4      free(_new);
     3.5  }
     3.6  
     3.7 -DYNAMIC_API const char *per_user_directory(void)
     3.8 +#ifndef NDEBUG
     3.9 +static const char *_per_user_directory(int reset)
    3.10 +#else 
    3.11 +static const char *_per_user_directory(void)
    3.12 +#endif
    3.13  {
    3.14      static char *path = NULL;
    3.15 +
    3.16 +#ifdef NDEBUG    
    3.17      if (path)
    3.18          return path;
    3.19 +#else        
    3.20 +    if (path && !reset)
    3.21 +        return path;
    3.22 +    else if (path) {
    3.23 +        free(path);
    3.24 +        path = NULL;
    3.25 +    }
    3.26 +#endif    
    3.27  
    3.28      const char *home = NULL;
    3.29  #ifndef NDEBUG
    3.30 @@ -355,10 +369,17 @@
    3.31  #endif
    3.32          return path;
    3.33  
    3.34 -    if (!per_user_directory())
    3.35 +    char* pathret = NULL;
    3.36 +#ifndef NDEBUG 
    3.37 +    pathret = _per_user_directory(reset);
    3.38 +#else 
    3.39 +    pathret = _per_user_directory();
    3.40 +#endif
    3.41 +
    3.42 +    if (!pathret)
    3.43          return NULL;
    3.44  
    3.45 -    path = strdup(per_user_directory());
    3.46 +    path = strdup(pathret);
    3.47      assert(path);
    3.48      if (!path)
    3.49          return NULL;
    3.50 @@ -471,6 +492,15 @@
    3.51      return path;
    3.52  }
    3.53  
    3.54 +DYNAMIC_API const char *per_user_directory(void) {
    3.55 +#ifdef NDEBUG
    3.56 +    return _per_user_directory(void);
    3.57 +#else 
    3.58 +    return _per_user_directory(false);
    3.59 +#endif
    3.60 +}
    3.61 +
    3.62 +
    3.63  static const char *gpg_conf_path = ".gnupg";
    3.64  static const char *gpg_conf_name = "gpg.conf";
    3.65  static const char *gpg_agent_conf_name = "gpg-agent.conf";
    3.66 @@ -707,4 +737,3 @@
    3.67      _empty(&path);
    3.68      return NULL;
    3.69  }
    3.70 -