diff options
Diffstat (limited to 'libsylph/utils.c')
-rw-r--r-- | libsylph/utils.c | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/libsylph/utils.c b/libsylph/utils.c index bd104e6e..428b5c84 100644 --- a/libsylph/utils.c +++ b/libsylph/utils.c @@ -3152,10 +3152,25 @@ gchar *generate_mime_boundary(const gchar *prefix) gint change_file_mode_rw(FILE *fp, const gchar *file) { +#ifdef G_OS_WIN32 + DWORD attr; + BOOL retval; + + attr = GetFileAttributes(file); + retval = SetFileAttributes + (file, attr & ~(FILE_ATTRIBUTE_READONLY|FILE_ATTRIBUTE_HIDDEN)); + if (retval) + return 0; + else + return -1; +#else #if HAVE_FCHMOD - return fchmod(fileno(fp), S_IRUSR|S_IWUSR); + if (fp) + return fchmod(fileno(fp), S_IRUSR|S_IWUSR); + else #else - return g_chmod(file, S_IRUSR|S_IWUSR); + return g_chmod(file, S_IRUSR|S_IWUSR); +#endif #endif } |