From a7fe86bc02f5b33cfc3c48a4d2e15d3ff94ffa16 Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Tue, 26 Jun 2007 13:48:44 +0000 Subject: More W32 related changes --- g10/ChangeLog | 9 +++++++-- g10/gpg.c | 1 + g10/gpgv.c | 1 + g10/openfile.c | 56 +++++++++++++++++++++++++++----------------------------- 4 files changed, 36 insertions(+), 31 deletions(-) (limited to 'g10') diff --git a/g10/ChangeLog b/g10/ChangeLog index 2958c9fff..477815825 100644 --- a/g10/ChangeLog +++ b/g10/ChangeLog @@ -1,8 +1,13 @@ +2007-06-26 Werner Koch + + * openfile.c (try_make_homedir): Support W32; use standard_homedir. + 2007-06-25 Werner Koch - * gpg.c (main): Replace iobuf_translate_file_handle by + * gpg.c, gpgv.c: Include sysutils.h. + (main): Replace iobuf_translate_file_handle by translate_sys2libc_fd. - * gpgv.c (main): Ditto. + 2007-06-21 Werner Koch diff --git a/g10/gpg.c b/g10/gpg.c index d1d79ea19..0eb21f079 100644 --- a/g10/gpg.c +++ b/g10/gpg.c @@ -53,6 +53,7 @@ #include "filter.h" #include "ttyio.h" #include "i18n.h" +#include "sysutils.h" #include "status.h" #include "keyserver-internal.h" #include "exec.h" diff --git a/g10/gpgv.c b/g10/gpgv.c index f7cac3457..72ee53c4b 100644 --- a/g10/gpgv.c +++ b/g10/gpgv.c @@ -48,6 +48,7 @@ #include "filter.h" #include "ttyio.h" #include "i18n.h" +#include "sysutils.h" #include "status.h" #include "call-agent.h" 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 ); + } } -- cgit v1.2.3