]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
Handle EDQUOT errno as "not enough disk space" like ENOSPC.
authorTimo Sirainen <tss@iki.fi>
Sun, 30 Mar 2003 12:48:36 +0000 (15:48 +0300)
committerTimo Sirainen <tss@iki.fi>
Sun, 30 Mar 2003 12:48:36 +0000 (15:48 +0300)
--HG--
branch : HEAD

src/lib-index/mail-custom-flags.c
src/lib-index/mail-index-compress.c
src/lib-index/mail-index-data.c
src/lib-index/mail-index-util.c
src/lib-index/mail-modifylog.c
src/lib-index/mail-tree.c
src/lib-index/maildir/maildir-index.c
src/lib-storage/index/index-save.c
src/lib-storage/index/maildir/maildir-save.c
src/lib-storage/index/mbox/mbox-save.c
src/lib/compat.h

index 3dd979162b7c07af69273ef1cd2fbc700624014e..e89dbf5e2d9068d56ccc629c2ac811a09502e1dd 100644 (file)
@@ -45,7 +45,7 @@ static int index_cf_set_syscall_error(struct mail_custom_flags *mcf,
 {
        i_assert(function != NULL);
 
-       if (errno == ENOSPC) {
+       if (ENOSPACE(errno)) {
                mcf->index->nodiskspace = TRUE;
                return FALSE;
        }
index 492b94e6eac9b0eca9577724847aad3b54cbcf75..6726bb0700ab1be0601566cd29bccb7866e49385 100644 (file)
@@ -226,7 +226,7 @@ int mail_index_compress_data(struct mail_index *index)
 
                datapath = t_strconcat(index->filepath, DATA_FILE_PREFIX, NULL);
                if (rename(temppath, datapath) < 0) {
-                       if (errno == ENOSPC)
+                       if (ENOSPACE(errno))
                                index->nodiskspace = TRUE;
 
                        index_set_error(index, "rename(%s, %s) failed: %m",
index c1f9a88892c7912405b1261f08c435e45a74390e..9e82f8e5d2424ecb41eaa2fc6a8f59ceec74578e 100644 (file)
@@ -66,7 +66,7 @@ static int index_data_set_syscall_error(struct mail_index_data *data,
 {
        i_assert(function != NULL);
 
-       if (errno == ENOSPC) {
+       if (ENOSPACE(errno)) {
                data->index->nodiskspace = TRUE;
                return FALSE;
        }
index e5a38b92c0e917765d42889644ddba9ee79aa217..863ed0307fe099499a693b74f3c2a81158e7b0e8 100644 (file)
@@ -52,7 +52,7 @@ int index_set_syscall_error(struct mail_index *index, const char *function)
 {
        i_assert(function != NULL);
 
-       if (errno == ENOSPC) {
+       if (ENOSPACE(errno)) {
                index->nodiskspace = TRUE;
                return FALSE;
        }
@@ -68,7 +68,7 @@ int index_file_set_syscall_error(struct mail_index *index, const char *filepath,
        i_assert(filepath != NULL);
        i_assert(function != NULL);
 
-       if (errno == ENOSPC) {
+       if (ENOSPACE(errno)) {
                index->nodiskspace = TRUE;
                return FALSE;
        }
@@ -109,7 +109,7 @@ int mail_index_create_temp_file(struct mail_index *index, const char **path)
           can't be helped. */
        fd = open(*path, O_RDWR | O_CREAT | O_EXCL, 0660);
        if (fd == -1) {
-               if (errno == ENOSPC)
+               if (ENOSPACE(errno))
                        index->nodiskspace = TRUE;
                else {
                        index_set_error(index, "Can't create temp index %s: %m",
index 2347a5cf70b76f36c48f36bc85a1fb2e8adbd1ee..923815b5d1a4b9a0d9c2fa9e762046aed4c04f22 100644 (file)
@@ -72,7 +72,7 @@ static int modifylog_set_syscall_error(struct modify_log_file *file,
 {
        i_assert(function != NULL);
 
-       if (errno == ENOSPC) {
+       if (ENOSPACE(errno)) {
                file->log->index->nodiskspace = TRUE;
                return FALSE;
        }
index f0985557e65203de385fde5959e471daf873de85..6e939c0ccaa1b1ceb7e92f71aa565ae88ca6cb5d 100644 (file)
@@ -19,7 +19,7 @@ static int tree_set_syscall_error(struct mail_tree *tree, const char *function)
 {
        i_assert(function != NULL);
 
-       if (errno == ENOSPC) {
+       if (ENOSPACE(errno)) {
                tree->index->nodiskspace = TRUE;
                return FALSE;
        }
index 9d6842faf6239e9ce9abdf240c575649d3f4277f..18d6775ab7ab84c95ef17d8044665d04a5d72b5f 100644 (file)
@@ -225,7 +225,7 @@ static int maildir_index_update_flags(struct mail_index *index,
 
                /* minor problem: new_path is overwritten if it exists.. */
                if (rename(old_path, new_path) < 0) {
-                       if (errno == ENOSPC)
+                       if (ENOSPACE(errno))
                                index->nodiskspace = TRUE;
 
                        index_set_error(index, "maildir flags update: "
index 6d070a623c6922c6375913a318527f3b4ce1086c..3806d4297dd49853d9d77bbd4134593d963d59ec 100644 (file)
@@ -82,7 +82,7 @@ static void set_write_error(struct mail_storage *storage,
                            struct ostream *output, const char *path)
 {
        errno = output->stream_errno;
-       if (errno == ENOSPC)
+       if (ENOSPACE(errno))
                mail_storage_set_error(storage, "Not enough disk space");
        else {
                mail_storage_set_critical(storage,
index b22d38ff79b2bec566ab32790e755d5bad7a20bd..7c082b4a7a3bb0243e544d96ec5986d8f66fa476 100644 (file)
@@ -72,7 +72,7 @@ static int maildir_create_tmp(struct mail_storage *storage, const char *dir,
 
        *fname = t_strdup(tmp_fname);
        if (fd == -1) {
-               if (errno == ENOSPC) {
+               if (ENOSPACE(errno)) {
                        mail_storage_set_error(storage,
                                "Not enough disk space");
                } else {
@@ -131,7 +131,7 @@ static int maildir_copy(struct mail_save_context *ctx,
                failed = FALSE;
        else {
                failed = TRUE;
-               if (errno == ENOSPC) {
+               if (ENOSPACE(errno)) {
                        mail_storage_set_error(ctx->ibox->box.storage,
                                               "Not enough disk space");
                } else {
index b95adc70cb5639d88a12bace2cafb8b2dc69dde6..eff08625ea051b4b76f923854bcd67b67ea5e015 100644 (file)
@@ -39,7 +39,7 @@ static int syscall_error(struct mail_save_context *ctx, const char *function)
 
 static int write_error(struct mail_save_context *ctx)
 {
-       if (errno == ENOSPC) {
+       if (ENOSPACE(errno)) {
                mail_storage_set_error(ctx->ibox->box.storage,
                                       "Not enough disk space");
        } else {
index 9100d104e2f63033eb1a71979e349d2d0b1ad841..486398dd859d2b2d83af288c1e359f27ed2986a8 100644 (file)
@@ -116,4 +116,10 @@ ssize_t my_writev(int fd, const struct iovec *iov, int iov_len);
 #  define EOVERFLOW EINVAL
 #endif
 
+#ifdef EDQUOT
+#  define ENOSPACE(errno) ((errno) == ENOSPC || (errno) == EDQUOT)
+#else
+#  define ENOSPACE(errno) ((errno) == ENOSPC)
+#endif
+
 #endif