diff options
author | Christopher James Lahey <clahey@ximian.com> | 2001-10-19 05:10:04 +0800 |
---|---|---|
committer | Chris Lahey <clahey@src.gnome.org> | 2001-10-19 05:10:04 +0800 |
commit | 5f5b342dbd14a76290ef758292eee40e3df6d2ee (patch) | |
tree | dbfade0498c1be018db1b71380bda6ea04c0691f /e-util/e-util.c | |
parent | 2b94e302c0e82f78e19491c22791150d74089162 (diff) | |
download | gsoc2013-evolution-5f5b342dbd14a76290ef758292eee40e3df6d2ee.tar.gz 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/e-util.c')
-rw-r--r-- | e-util/e-util.c | 32 |
1 files changed, 31 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; } |