aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNot Zed <NotZed@HelixCode.com>2000-11-16 16:36:39 +0800
committerMichael Zucci <zucchi@src.gnome.org>2000-11-16 16:36:39 +0800
commitd39149c5797d79e902621585554985132c1e445d (patch)
tree5319382fa77e77f4b80f78d3ff7c5f31b69b7802
parentc484e227fd338b26e4bf1b075dc8a7701d77a120 (diff)
downloadgsoc2013-evolution-d39149c5797d79e902621585554985132c1e445d.tar
gsoc2013-evolution-d39149c5797d79e902621585554985132c1e445d.tar.gz
gsoc2013-evolution-d39149c5797d79e902621585554985132c1e445d.tar.bz2
gsoc2013-evolution-d39149c5797d79e902621585554985132c1e445d.tar.lz
gsoc2013-evolution-d39149c5797d79e902621585554985132c1e445d.tar.xz
gsoc2013-evolution-d39149c5797d79e902621585554985132c1e445d.tar.zst
gsoc2013-evolution-d39149c5797d79e902621585554985132c1e445d.zip
New file - utility functions for locking using different strategies and/or
2000-11-16 Not Zed <NotZed@HelixCode.com> * camel-lock.c: New file - utility functions for locking using different strategies and/or for locking folders safely. * Makefile.am (libcamel_la_SOURCES): Adde camel-lock.[ch] svn path=/trunk/; revision=6590
-rw-r--r--camel/ChangeLog7
-rw-r--r--camel/Makefile.am2
-rw-r--r--camel/camel-exception.h2
-rw-r--r--camel/camel-lock.c14
-rw-r--r--camel/camel-movemail.c2
-rw-r--r--camel/providers/local/camel-local-folder.h5
6 files changed, 22 insertions, 10 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog
index cb77f14688..42d17ed4e3 100644
--- a/camel/ChangeLog
+++ b/camel/ChangeLog
@@ -1,3 +1,10 @@
+2000-11-16 Not Zed <NotZed@HelixCode.com>
+
+ * camel-lock.c: New file - utility functions for locking using
+ different strategies and/or for locking folders safely.
+
+ * Makefile.am (libcamel_la_SOURCES): Adde camel-lock.[ch]
+
2000-11-15 Radek Doulik <rodo@helixcode.com>
* camel-mime-utils.c: mime_guess_type_from_file_name moved back to
diff --git a/camel/Makefile.am b/camel/Makefile.am
index 8f487fdf68..9e419c254a 100644
--- a/camel/Makefile.am
+++ b/camel/Makefile.am
@@ -24,6 +24,7 @@ libcamel_la_SOURCES = \
camel-folder-summary.c \
camel-folder.c \
camel-internet-address.c \
+ camel-lock.c \
camel-medium.c \
camel-mime-filter-bestenc.c \
camel-mime-filter-basic.c \
@@ -77,6 +78,7 @@ libcamelinclude_HEADERS = \
camel-folder-summary.h \
camel-folder.h \
camel-internet-address.h \
+ camel-lock.h \
camel-medium.h \
camel-mime-filter-bestenc.h \
camel-mime-filter-basic.h \
diff --git a/camel/camel-exception.h b/camel/camel-exception.h
index d5c93e5941..bb8df1a6fc 100644
--- a/camel/camel-exception.h
+++ b/camel/camel-exception.h
@@ -77,7 +77,7 @@ void camel_exception_xfer (CamelException *ex_dst,
/* exception content retrieval */
ExceptionId camel_exception_get_id (CamelException *ex);
-const gchar * camel_exception_get_description (CamelException *ex);
+const char * camel_exception_get_description (CamelException *ex);
#define camel_exception_is_set(ex) (camel_exception_get_id (ex) != CAMEL_EXCEPTION_NONE)
diff --git a/camel/camel-lock.c b/camel/camel-lock.c
index d6c3ad9312..f14e4ece5d 100644
--- a/camel/camel-lock.c
+++ b/camel/camel-lock.c
@@ -22,16 +22,20 @@
#include <config.h>
-/* need configure checks here */
+/* need configure checks or some configurable thingy here */
#define USE_DOT
#define USE_FCNTL
#define USE_FLOCK
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
#include <sys/stat.h>
#include <unistd.h>
#include <errno.h>
#include <alloca.h>
-#include <string.h>
+#include <time.h>
#ifdef USE_DOT
#include <sys/types.h>
@@ -51,7 +55,7 @@
#include "camel-lock.h"
/* dunno where this fucking thing is got from */
-/*#define _(x) (x)*/
+#define _(x) (x)
#define d(x) (printf("%s(%d): ", __FILE__, __LINE__),(x))
@@ -71,7 +75,7 @@ camel_lock_dot(const char *path, CamelException *ex)
#ifdef USE_DOT
char *locktmp, *lock;
int retry = 0;
- int fdtmp, fd;
+ int fdtmp;
struct stat st;
/* TODO: Is there a reliable way to refresh the lock, if we're still busy with it?
@@ -133,7 +137,7 @@ camel_lock_dot(const char *path, CamelException *ex)
/* check for stale lock, kill it */
if (stat(lock, &st) == 0) {
time_t now = time(0);
- d(printf("There is an existing lock %d seconds old\n", now-st.st_ctime));
+ d(printf("There is an existing lock %ld seconds old\n", now-st.st_ctime));
if (st.st_ctime < now - CAMEL_LOCK_DOT_STALE) {
d(printf("Removing it now\n"));
unlink(lock);
diff --git a/camel/camel-movemail.c b/camel/camel-movemail.c
index ea3fdb3da0..bd5022f421 100644
--- a/camel/camel-movemail.c
+++ b/camel/camel-movemail.c
@@ -35,6 +35,7 @@
#include <unistd.h>
#include <string.h>
#include <signal.h>
+#include <alloca.h>
#include "camel-movemail.h"
#include "camel-exception.h"
@@ -590,3 +591,4 @@ fail:
return -1;
}
#endif
+
diff --git a/camel/providers/local/camel-local-folder.h b/camel/providers/local/camel-local-folder.h
index 96e4b23187..fa0ad34e84 100644
--- a/camel/providers/local/camel-local-folder.h
+++ b/camel/providers/local/camel-local-folder.h
@@ -1,5 +1,4 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
*
* Author: Michael Zucchi <notzed@helixcode.com>
*
@@ -21,11 +20,9 @@
* USA
*/
-
#ifndef CAMEL_LOCAL_FOLDER_H
#define CAMEL_LOCAL_FOLDER_H 1
-
#ifdef __cplusplus
extern "C" {
#pragma }