aboutsummaryrefslogtreecommitdiffstats
path: root/e-util
diff options
context:
space:
mode:
authorChristopher James Lahey <clahey@ximian.com>2001-10-19 05:10:04 +0800
committerChris Lahey <clahey@src.gnome.org>2001-10-19 05:10:04 +0800
commit5f5b342dbd14a76290ef758292eee40e3df6d2ee (patch)
treedbfade0498c1be018db1b71380bda6ea04c0691f /e-util
parent2b94e302c0e82f78e19491c22791150d74089162 (diff)
downloadgsoc2013-evolution-5f5b342dbd14a76290ef758292eee40e3df6d2ee.tar
gsoc2013-evolution-5f5b342dbd14a76290ef758292eee40e3df6d2ee.tar.gz
gsoc2013-evolution-5f5b342dbd14a76290ef758292eee40e3df6d2ee.tar.bz2
gsoc2013-evolution-5f5b342dbd14a76290ef758292eee40e3df6d2ee.tar.lz
gsoc2013-evolution-5f5b342dbd14a76290ef758292eee40e3df6d2ee.tar.xz
gsoc2013-evolution-5f5b342dbd14a76290ef758292eee40e3df6d2ee.tar.zst
gsoc2013-evolution-5f5b342dbd14a76290ef758292eee40e3df6d2ee.zip
Bumped the version number to 0.15.99.1.
2001-10-18 Christopher James Lahey <clahey@ximian.com> * configure.in: Bumped the version number to 0.15.99.1. * gal/util/e-util.c, gal/util/e-util.h (e_write_file_mkstemp): New function to create a unique file. (e_write_file): Check the return value of close here. svn path=/trunk/; revision=13772
Diffstat (limited to 'e-util')
-rw-r--r--e-util/e-util.c32
-rw-r--r--e-util/e-util.h2
2 files changed, 33 insertions, 1 deletions
diff --git a/e-util/e-util.c b/e-util/e-util.c
index b209aa7dde..914c97c47a 100644
--- a/e-util/e-util.c
+++ b/e-util/e-util.c
@@ -195,7 +195,37 @@ e_write_file(const char *filename, const char *data, int flags)
}
}
}
- close(fd);
+ if (close(fd) != 0) {
+ return errno;
+ }
+ return 0;
+}
+
+gint
+e_write_file_mkstemp(char *filename, const char *data)
+{
+ int fd;
+ int length = strlen(data);
+ int bytes;
+ fd = mkstemp (filename);
+ if (fd == -1)
+ return errno;
+ while (length > 0) {
+ bytes = write(fd, data, length);
+ if (bytes > 0) {
+ length -= bytes;
+ data += bytes;
+ } else {
+ if (errno != EINTR && errno != EAGAIN) {
+ int save_errno = errno;
+ close(fd);
+ return save_errno;
+ }
+ }
+ }
+ if (close(fd) != 0) {
+ return errno;
+ }
return 0;
}
diff --git a/e-util/e-util.h b/e-util/e-util.h
index f7b2bf7a3c..666dc62320 100644
--- a/e-util/e-util.h
+++ b/e-util/e-util.h
@@ -81,6 +81,8 @@ char *e_read_file (cons
int e_write_file (const char *filename,
const char *data,
int flags);
+int e_write_file_mkstemp (char *filename,
+ const char *data);
int e_mkdir_hier (const char *path,
mode_t mode);