This commit is contained in:
Dirk-Jan C. Binnema
2011-08-11 08:22:24 +03:00
parent 8f7ef5d748
commit b1d0de2cab
4 changed files with 18 additions and 11 deletions

View File

@ -314,7 +314,7 @@ cmd_mv_dev_null (MuConfig *opts)
}
if (opts->printtarget)
g_print ("%s\n", "/dev/null"); /* /dev/null */
g_print ("/dev/null\n"); /* /dev/null */
return MU_EXITCODE_OK;
}
@ -365,7 +365,7 @@ check_file_okay (const char *path, gboolean cmd_add)
return FALSE;
}
if (cmd_add && access (path, R_OK) != 0) {
if (cmd_add && access(path, R_OK) != 0) {
g_warning ("path is not readable: %s: %s",
path, strerror (errno));
return FALSE;

View File

@ -698,11 +698,11 @@ get_maildir_type (const char *path)
* the closing '/'... if it does, remove it */
if (dirname[strlen(dirname) - 1 ] == G_DIR_SEPARATOR)
dirname[strlen(dirname) - 1] = '\0';
if (g_str_has_suffix (dirname, "cur"))
mtype = MAILDIR_TYPE_CUR;
else if (g_str_has_suffix (dirname, "new"))
mtype = MAILDIR_TYPE_CUR;
mtype = MAILDIR_TYPE_NEW;
else
mtype = MAILDIR_TYPE_OTHER;
@ -739,9 +739,8 @@ get_new_fullpath (const char *oldpath, const char *targetmdir,
filename);
g_free (filename);
/* if flags != MU_MSG_FLAG_UNKNOWN, we update the filename for
* the new flags; in case the NEW flag is set/unset, this can
* also influence the dir */
/* we update the filename for the new flags; in case the NEW
* flag is set/unset, this can also influence the dir */
if (flags != MU_MSG_FLAG_NONE) {
gchar *tmp;
tmp = mu_maildir_get_path_from_flags (newfullpath, flags);
@ -802,7 +801,7 @@ check_source_file (const char *src, MaildirType *mtype, GError **err)
}
*mtype = get_maildir_type (src);
if (mtype != MAILDIR_TYPE_CUR && *mtype != MAILDIR_TYPE_NEW) {
if (*mtype != MAILDIR_TYPE_CUR && *mtype != MAILDIR_TYPE_NEW) {
g_set_error (err, 0, MU_ERROR_FILE,
"source is not in a maildir: '%s'", src);
return FALSE;
@ -859,7 +858,12 @@ mu_msg_file_move_to_maildir (const char* oldpath, const char* targetmdir,
return FALSE;
}
/* TODO: check for oldpath == newfullpath */
if (g_strcmp0 (oldpath, newfullpath)) {
g_set_error (err, 0, MU_ERROR_FILE,
"target equals source");
return FALSE;
}
rv = msg_move (oldpath, newfullpath, err);
if (!rv) {
g_free (newfullpath);

View File

@ -121,7 +121,7 @@ add_synonym_for_flag (MuMsgFlags flag, Xapian::WritableDatabase *db)
db->clear_synonyms (pfx + mu_msg_flag_name (flag));
db->add_synonym (pfx + mu_msg_flag_name (flag), pfx +
(std::string(1, mu_msg_flag_char (flag))));
(std::string(1, tolower(mu_msg_flag_char (flag)))));
}

View File

@ -406,7 +406,9 @@ enum _MuExitCode {
MU_EXITCODE_NO_MATCHES = 2,
MU_EXITCODE_DB_LOCKED = 3,
MU_EXITCODE_DB_CORRUPTED = 4,
MU_EXITCODE_DB_UPDATE_ERROR = 5
MU_EXITCODE_DB_UPDATE_ERROR = 5,
MU_EXITCODE_FILE_ERROR = 6
};
typedef enum _MuExitCode MuExitCode;
@ -432,6 +434,7 @@ enum _MuError {
MU_ERROR_FILE_CANNOT_MKDIR,
MU_ERROR_FILE_STAT_FAILED,
MU_ERROR_FILE_READDIR_FAILED,
/* generic file-related error */
MU_ERROR_FILE,