summaryrefslogtreecommitdiffstats
path: root/g10/openfile.c
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2007-06-26 15:48:44 +0200
committerWerner Koch <wk@gnupg.org>2007-06-26 15:48:44 +0200
commita7fe86bc02f5b33cfc3c48a4d2e15d3ff94ffa16 (patch)
tree56d859ed11c7dc6faec9df7d6c55fbdf3b334b87 /g10/openfile.c
parentFixed a problem in estream-printf.c. (diff)
downloadgnupg2-a7fe86bc02f5b33cfc3c48a4d2e15d3ff94ffa16.tar.xz
gnupg2-a7fe86bc02f5b33cfc3c48a4d2e15d3ff94ffa16.zip
More W32 related changes
Diffstat (limited to 'g10/openfile.c')
-rw-r--r--g10/openfile.c56
1 files changed, 27 insertions, 29 deletions
diff --git a/g10/openfile.c b/g10/openfile.c
index 095aad9f4..949299ae7 100644
--- a/g10/openfile.c
+++ b/g10/openfile.c
@@ -404,37 +404,35 @@ copy_options_file( const char *destdir )
void
-try_make_homedir( const char *fname )
+try_make_homedir (const char *fname)
{
- const char *defhome = GNUPG_DEFAULT_HOMEDIR;
-#ifdef HAVE_W32_SYSTEM
-#warning use a function and not a constant
-#endif
+ const char *defhome = standard_homedir ();
- /* Create the directory only if the supplied directory name
- * is the same as the default one. This way we avoid to create
- * arbitrary directories when a non-default homedirectory is used.
- * To cope with HOME, we do compare only the suffix if we see that
- * the default homedir does start with a tilde.
- */
- if( opt.dry_run || opt.no_homedir_creation )
- return;
+ /* Create the directory only if the supplied directory name is the
+ same as the default one. This way we avoid to create arbitrary
+ directories when a non-default home directory is used. To cope
+ with HOME, we do compare only the suffix if we see that the
+ default homedir does start with a tilde. */
+ if ( opt.dry_run || opt.no_homedir_creation )
+ return;
- if ( ( *defhome == '~'
- && ( strlen(fname) >= strlen (defhome+1)
- && !strcmp(fname+strlen(fname)-strlen(defhome+1),
- defhome+1 ) ))
- || ( *defhome != '~'
- && !compare_filenames( fname, defhome ) )
- ) {
- if( mkdir( fname, S_IRUSR|S_IWUSR|S_IXUSR ) )
- log_fatal( _("can't create directory `%s': %s\n"),
- fname, strerror(errno) );
- else if( !opt.quiet )
- log_info( _("directory `%s' created\n"), fname );
- copy_options_file( fname );
-/* log_info(_("you have to start GnuPG again, " */
-/* "so it can read the new configuration file\n") ); */
-/* g10_exit(1); */
+ if (
+#ifdef HAVE_W32_SYSTEM
+ ( !compare_filenames (fname, defhome) )
+#else
+ ( *defhome == '~'
+ && (strlen(fname) >= strlen (defhome+1)
+ && !strcmp(fname+strlen(fname)-strlen(defhome+1), defhome+1 ) ))
+ || (*defhome != '~' && !compare_filenames( fname, defhome ) )
+#endif
+ )
+ {
+ if ( mkdir (fname, S_IRUSR|S_IWUSR|S_IXUSR) )
+ log_fatal ( _("can't create directory `%s': %s\n"),
+ fname, strerror(errno) );
+ else if (!opt.quiet )
+ log_info ( _("directory `%s' created\n"), fname );
+ copy_options_file( fname );
+
}
}