diff options
| author | Jules Colding <jcolding@src.gnome.org> | 2007-05-16 13:56:07 +0000 |
|---|---|---|
| committer | Jules Colding <jcolding@src.gnome.org> | 2007-05-16 13:56:07 +0000 |
| commit | 1a1b76736a541165dc607de9ccf20d3ad7017990 (patch) | |
| tree | c0c5eea135801c435e3e3384090f5264ca22e265 | |
| parent | c32bf6350982c6c71a9a7c6409aba21620170202 (diff) | |
| download | evolution-data-server-1a1b76736a541165dc607de9ccf20d3ad7017990.tar.gz | |
Fix file descriptor leaks from open() and friends as well as a little cleanup
svn path=/trunk/; revision=7761
28 files changed, 159 insertions, 86 deletions
@@ -1,3 +1,13 @@ +2007-05-16 Jules Colding <colding@omesc.com> + + * configure.in: Removed unused function check + +2007-05-14 Jules Colding <colding@omesc.com> + + * libedataserver/e-db3-utils.c (cp_file): Cleanup. Fix file descriptor leak. + + * libedataserver/md5-utils.c (md5_get_digest_from_file): Fix file descriptor leak + 2007-05-14 Srinivasa Ragavan * NEWS, configure.in: Evolution Data Server 1.11.2 release. diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog index ee8b101fe..6ce20be3b 100644 --- a/addressbook/ChangeLog +++ b/addressbook/ChangeLog @@ -1,3 +1,10 @@ +2007-05-16 Jules Colding <colding@omesc.com> + + * backends/vcf/e-book-backend-vcf.c (load_file): Fix file descriptor leak. + (save_file): Cleanup. Fix file descriptor leak. + + * tests/vcard/dump-vcard.c (main): Fix file descriptor leak + 2007-05-15 Ross Burton <ross@openedhand.com> * tests/ebook/test-ebook-async.c: diff --git a/addressbook/backends/vcf/e-book-backend-vcf.c b/addressbook/backends/vcf/e-book-backend-vcf.c index d22c94037..e853703b4 100644 --- a/addressbook/backends/vcf/e-book-backend-vcf.c +++ b/addressbook/backends/vcf/e-book-backend-vcf.c @@ -110,6 +110,7 @@ load_file (EBookBackendVCF *vcf, int fd) fp = fdopen (fd, "rb"); if (!fp) { + close (fd); /* callers depend on fd being closed by this function */ g_warning ("failed to open `%s' for reading", vcf->priv->filename); return; } @@ -140,6 +141,7 @@ load_file (EBookBackendVCF *vcf, int fd) static gboolean save_file (EBookBackendVCF *vcf) { + gboolean retv = FALSE; GList *l; char *new_path; int fd, rv; @@ -151,6 +153,10 @@ save_file (EBookBackendVCF *vcf) new_path = g_strdup_printf ("%s.new", vcf->priv->filename); fd = g_open (new_path, O_CREAT | O_TRUNC | O_WRONLY | O_BINARY, 0666); + if (fd == -1) { + g_warning ("write failed. could not open output file\n"); + goto out; + } for (l = vcf->priv->contact_list; l; l = l->next) { char *vcard_str = l->data; @@ -161,34 +167,34 @@ save_file (EBookBackendVCF *vcf) if (rv < len) { /* XXX */ g_warning ("write failed. we need to handle short writes\n"); - close (fd); g_unlink (new_path); - return FALSE; + goto out; } rv = write (fd, "\r\n\r\n", 4); if (rv < 4) { /* XXX */ g_warning ("write failed. we need to handle short writes\n"); - close (fd); g_unlink (new_path); - return FALSE; + goto out; } } if (0 > g_rename (new_path, vcf->priv->filename)) { g_warning ("Failed to rename %s: %s\n", vcf->priv->filename, strerror(errno)); g_unlink (new_path); - return FALSE; + goto out; } + retv = TRUE; +out: + if (fd != -1) + close (fd); g_free (new_path); - - vcf->priv->dirty = FALSE; - + vcf->priv->dirty = !retv; g_mutex_unlock (vcf->priv->mutex); - return TRUE; + return retv; } static gboolean diff --git a/addressbook/tests/vcard/dump-vcard.c b/addressbook/tests/vcard/dump-vcard.c index 576520781..95851e577 100644 --- a/addressbook/tests/vcard/dump-vcard.c +++ b/addressbook/tests/vcard/dump-vcard.c @@ -23,6 +23,7 @@ main(int argc, char **argv) if (fgets (buf, sizeof(buf), fp)) str = g_string_append (str, buf); } + fclose (fp); vcard = e_vcard_new_from_string (str->str); diff --git a/calendar/ChangeLog b/calendar/ChangeLog index 7f4ba5c66..33046cfd7 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,3 +1,14 @@ +2007-05-16 Jules Colding <colding@omesc.com> + + * backends/groupwise/e-cal-backend-groupwise.c (fetch_attachments): + Do not close() if (fd == -1) + + * backends/groupwise/e-cal-backend-groupwise-utils.c (set_attachments_to_cal_component): + Do not close() if (fd == -1) + + * backends/file/e-cal-backend-file.c (fetch_attachments): + Do not close() if (fd == -1) + 2007-05-15 Ross Burton <ross@openedhand.com> * tests/ecal/test-ecal.c: diff --git a/calendar/backends/file/e-cal-backend-file.c b/calendar/backends/file/e-cal-backend-file.c index a18d81e95..d4e457019 100644 --- a/calendar/backends/file/e-cal-backend-file.c +++ b/calendar/backends/file/e-cal-backend-file.c @@ -2352,7 +2352,8 @@ fetch_attachments (ECalBackendSync *backend, ECalComponent *comp) } g_mapped_file_free (mapped_file); - close (fd); + if (fd != -1) + close (fd); dest_url = g_filename_to_uri (dest_file, NULL, NULL); g_free (dest_file); new_attach_list = g_slist_append (new_attach_list, dest_url); diff --git a/calendar/backends/groupwise/e-cal-backend-groupwise-utils.c b/calendar/backends/groupwise/e-cal-backend-groupwise-utils.c index 3dd244f23..3156a85cb 100644 --- a/calendar/backends/groupwise/e-cal-backend-groupwise-utils.c +++ b/calendar/backends/groupwise/e-cal-backend-groupwise-utils.c @@ -833,7 +833,8 @@ set_attachments_to_cal_component (EGwItem *item, ECalComponent *comp, ECalBacken g_warning ("DEBUG: attachment write failed.\n"); } g_free (attach_data); - close (fd); + if (fd != -1) + close (fd); } g_free (filename); diff --git a/calendar/backends/groupwise/e-cal-backend-groupwise.c b/calendar/backends/groupwise/e-cal-backend-groupwise.c index da9daab7a..c631fb75d 100644 --- a/calendar/backends/groupwise/e-cal-backend-groupwise.c +++ b/calendar/backends/groupwise/e-cal-backend-groupwise.c @@ -2279,7 +2279,8 @@ fetch_attachments (ECalBackendGroupwise *cbgw, ECalComponent *comp) } g_mapped_file_free (mapped_file); - close (fd); + if (fd != -1) + close (fd); dest_url = g_filename_to_uri (dest_file, NULL, NULL); g_free (dest_file); new_attach_list = g_slist_append (new_attach_list, dest_url); diff --git a/camel/ChangeLog b/camel/ChangeLog index 7ff0dac9b..ce0b81ad8 100644 --- a/camel/ChangeLog +++ b/camel/ChangeLog @@ -1,16 +1,34 @@ -2007-05-15 Srinivasa Ragavan <sragavan@novell.com> +2007-05-16 Jules Colding <colding@omesc.com> + * camel-lock.c (camel_lock_dot): Use g_mkstemp() - * camel-disco-store.c: (camel_disco_store_prepare_for_offline): Added - a new api to fetch a folder for offline sync. - * camel-disco-store.h: + * camel-folder-summary.c (camel_folder_summary_save): Fix file descriptor leak. + fclose() a fdopen() stream instead of close()'ing the underlying file descriptor. + + * camel-uid-cache.c (camel_uid_cache_save): Cleanups, such as + setting cache->fd = -1 when fd has been closed. + + * camel-block-file.c (key_file_use): Do not close() if (fd == -1) + + * camel-index-control.c (do_perf): Fix file descriptor leak + + * camel-charset-map.c (main): Check for return value + + * camel-text-index.c (dump_raw): Fix file descriptor leak + + * camel-lock.c (main): Fix file descriptor leak. -2007-05-12 Jules Colding <colding@omesc.com> - * camel-lock-client.c (camel_lock_helper_init): Fix file descriptor leak * camel-process.c (camel_process_fork): Fix file descriptor leak +2007-05-15 Srinivasa Ragavan <sragavan@novell.com> + + + * camel-disco-store.c: (camel_disco_store_prepare_for_offline): Added + a new api to fetch a folder for offline sync. + * camel-disco-store.h: + 2007-05-12 Jules Colding <colding@omesc.com> * camel-store.h (CamelFolderInfo): Change type of unread and total diff --git a/camel/camel-block-file.c b/camel/camel-block-file.c index 3546bc4e4..abf1ed7a4 100644 --- a/camel/camel-block-file.c +++ b/camel/camel-block-file.c @@ -916,7 +916,8 @@ key_file_use(CamelKeyFile *bs) if ((fd = g_open(bs->path, bs->flags|O_BINARY, 0600)) == -1 || (bs->fp = fdopen(fd, flag)) == NULL) { err = errno; - close(fd); + if (fd != -1) + close(fd); CAMEL_KEY_FILE_UNLOCK(bs, lock); errno = err; return -1; diff --git a/camel/camel-charset-map.c b/camel/camel-charset-map.c index c58ca47bf..325e5a317 100644 --- a/camel/camel-charset-map.c +++ b/camel/camel-charset-map.c @@ -106,6 +106,8 @@ int main (void) for (j = 0; tables[j].name; j++) { cd = iconv_open (UCS, tables[j].name); + if (cd == (iconv_t)-1) + exit (1); inptr = in; outptr = (char *)(out); inlen = sizeof (in); diff --git a/camel/camel-folder-summary.c b/camel/camel-folder-summary.c index 3534ac6b5..b361c79f5 100644 --- a/camel/camel-folder-summary.c +++ b/camel/camel-folder-summary.c @@ -687,14 +687,16 @@ camel_folder_summary_save(CamelFolderSummary *s) path_meta = alloca(strlen(s->meta_summary->path)+4); sprintf(path_meta, "%s~", s->meta_summary->path); fd_meta = g_open(path_meta, O_RDWR|O_CREAT|O_TRUNC|O_BINARY, 0600); - if (fd_meta == -1) + if (fd_meta == -1) { + fclose(out); return -1; + } out_meta = fdopen(fd_meta, "wb"); if (out_meta == NULL) { i = errno; g_unlink(path); g_unlink(path_meta); - close(fd); + fclose(out); close(fd_meta); errno = i; return -1; diff --git a/camel/camel-index-control.c b/camel/camel-index-control.c index 15d4a8346..a2f252146 100644 --- a/camel/camel-index-control.c +++ b/camel/camel-index-control.c @@ -172,6 +172,7 @@ do_perf(int argc, char **argv) idx = (CamelIndex *)camel_text_index_new("/tmp/index", O_TRUNC|O_CREAT|O_RDWR); if (idx == NULL) { perror("open index"); + closedir(dir); return 1; } diff --git a/camel/camel-lock.c b/camel/camel-lock.c index e624e6bde..be738ec2b 100644 --- a/camel/camel-lock.c +++ b/camel/camel-lock.c @@ -89,17 +89,6 @@ camel_lock_dot(const char *path, CamelException *ex) sprintf(lock, "%s.lock", path); locktmp = alloca(strlen(path) + strlen("XXXXXX") + 1); -#ifndef HAVE_MKSTEMP - sprintf(locktmp, "%sXXXXXX", path); - if (mktemp(locktmp) == NULL) { - /* well, this is really only a programatic error */ - camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, - _("Could not create lock file for %s: %s"), - path, g_strerror (errno)); - return -1; - } -#endif - while (retry < CAMEL_LOCK_DOT_RETRY) { d(printf("trying to lock '%s', attempt %d\n", lock, retry)); @@ -107,12 +96,8 @@ camel_lock_dot(const char *path, CamelException *ex) if (retry > 0) sleep(CAMEL_LOCK_DOT_DELAY); -#ifdef HAVE_MKSTEMP sprintf(locktmp, "%sXXXXXX", path); - fdtmp = mkstemp(locktmp); -#else - fdtmp = open(locktmp, O_RDWR|O_CREAT|O_EXCL, 0600); -#endif + fdtmp = g_mkstemp(locktmp); if (fdtmp == -1) { camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, _("Could not create lock file for %s: %s"), @@ -372,7 +357,16 @@ int main(int argc, char **argv) #endif fd1 = open("mylock", O_RDWR); + if (fd1 == -1) { + printf("Could not open lock file (mylock): %s", g_strerror (errno)); + return 1; + } fd2 = open("mylock", O_RDWR); + if (fd2 == -1) { + printf("Could not open lock file (mylock): %s", g_strerror (errno)); + close (fd1); + return 1; + } if (camel_lock_fcntl(fd1, CAMEL_LOCK_WRITE, ex) == 0) { printf("got fcntl write lock once\n"); diff --git a/camel/camel-text-index.c b/camel/camel-text-index.c index 41702f8b4..0a9952b03 100644 --- a/camel/camel-text-index.c +++ b/camel/camel-text-index.c @@ -1172,6 +1172,7 @@ dump_raw(GHashTable *map, char *path) } while (len); printf("\n"); } + close (fd); } #endif @@ -1937,6 +1938,7 @@ int main(int argc, char **argv) index++; } + fclose (fp); printf("Freeing partition index\n"); camel_partition_table_free(cpi); diff --git a/camel/camel-uid-cache.c b/camel/camel-uid-cache.c index a72fd2d0f..b410eb532 100644 --- a/camel/camel-uid-cache.c +++ b/camel/camel-uid-cache.c @@ -169,15 +169,13 @@ camel_uid_cache_save (CamelUIDCache *cache) cache->expired = 0; g_hash_table_foreach (cache->uids, maybe_write_uid, cache); - if (cache->fd == -1) - goto exception; - if (fsync (fd) == -1) goto exception; close (fd); fd = -1; - + cache->fd = -1; + if (g_rename (filename, cache->filename) == -1) goto exception; @@ -211,14 +209,16 @@ camel_uid_cache_save (CamelUIDCache *cache) if (ftruncate (fd, (off_t) cache->size) != -1) { cache->size = 0; cache->expired = 0; - goto overwrite; + goto overwrite; /* FIXME: no such label */ } - } - - close (fd); + } } #endif - + if (fd != -1) { + close (fd); + cache->fd = -1; + } + g_unlink (filename); g_free (filename); diff --git a/camel/providers/local/ChangeLog b/camel/providers/local/ChangeLog index 70ee10165..2f9b3701b 100644 --- a/camel/providers/local/ChangeLog +++ b/camel/providers/local/ChangeLog @@ -1,3 +1,16 @@ +2007-05-16 Jules Colding <colding@omesc.com> + + * camel-spool-summary.c (spool_summary_sync_full): Use g_mkstemp() + +2007-05-14 Jules Colding <colding@omesc.com> + + * camel-mh-summary.c (mh_summary_next_uid_string): Do not close() if (fd == -1). + + * camel-spool-summary.c (spool_summary_sync_full): alloca() changed into malloc(). + alloca() has undefined behaviour for stack overflow so it shouldn't really be used + unless there is a *very* good reason. Cleanups related to this fix as well. Do not + close() if (fd == -1). + 2007-04-05 Ross Burton <ross@openedhand.com> * camel-local-store.c: (get_folder): diff --git a/camel/providers/local/camel-mh-summary.c b/camel/providers/local/camel-mh-summary.c index 9184eb5a9..e398145fd 100644 --- a/camel/providers/local/camel-mh-summary.c +++ b/camel/providers/local/camel-mh-summary.c @@ -147,7 +147,8 @@ static char *mh_summary_next_uid_string(CamelFolderSummary *s) } else { /* else scan for one - and create it too, to make sure */ do { - close(fd); + if (fd != -1) + close(fd); uid = camel_folder_summary_next_uid(s); name = g_strdup_printf("%s/%u", cls->folder_path, uid); /* O_EXCL isn't guaranteed, sigh. Oh well, bad luck, mh has problems anyway */ @@ -155,7 +156,8 @@ static char *mh_summary_next_uid_string(CamelFolderSummary *s) g_free(name); } while (fd == -1 && errno == EEXIST); - close(fd); + if (fd != -1) + close(fd); uidstr = g_strdup_printf("%u", uid); } diff --git a/camel/providers/local/camel-spool-summary.c b/camel/providers/local/camel-spool-summary.c index 5549cec66..f751b2694 100644 --- a/camel/providers/local/camel-spool-summary.c +++ b/camel/providers/local/camel-spool-summary.c @@ -128,7 +128,7 @@ static int spool_summary_sync_full(CamelMboxSummary *cls, gboolean expunge, CamelFolderChangeInfo *changeinfo, CamelException *ex) { int fd = -1, fdout = -1; - char *tmpname = NULL; + char tmpname[64] = { '\0' }; char *buffer, *p; off_t spoollen, outlen; int size, sizeout; @@ -149,16 +149,9 @@ spool_summary_sync_full(CamelMboxSummary *cls, gboolean expunge, CamelFolderChan return -1; } -#ifdef HAVE_MKSTEMP - tmpname = alloca (64); sprintf (tmpname, "/tmp/spool.camel.XXXXXX"); - fdout = mkstemp (tmpname); -#else -#warning "Your system has no mkstemp(3), spool updating may be insecure" - tmpname = alloca (L_tmpnam); - tmpnam (tmpname); - fdout = open (tmpname, O_RDWR|O_CREAT|O_EXCL, 0600); -#endif + fdout = g_mkstemp (tmpname); + d(printf("Writing tmp file to %s\n", tmpname)); if (fdout == -1) { camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, @@ -245,11 +238,9 @@ spool_summary_sync_full(CamelMboxSummary *cls, gboolean expunge, CamelFolderChan _("Could not sync spool folder %s: %s\n" "Folder may be corrupt, copy saved in `%s'"), ((CamelLocalSummary *)cls)->folder_path, - g_strerror (errno), tmpnam); + g_strerror (errno), tmpname); /* so we dont delete it */ - close(fdout); - tmpname = NULL; - fdout = -1; + tmpname[0] = '\0'; g_free(buffer); goto error; } @@ -264,10 +255,8 @@ spool_summary_sync_full(CamelMboxSummary *cls, gboolean expunge, CamelFolderChan _("Could not sync spool folder %s: %s\n" "Folder may be corrupt, copy saved in `%s'"), ((CamelLocalSummary *)cls)->folder_path, - g_strerror (errno), tmpnam); - close(fdout); - tmpname = NULL; - fdout = -1; + g_strerror (errno), tmpname); + tmpname[0] = '\0'; goto error; } @@ -277,16 +266,16 @@ spool_summary_sync_full(CamelMboxSummary *cls, gboolean expunge, CamelFolderChan _("Could not sync spool folder %s: %s\n" "Folder may be corrupt, copy saved in `%s'"), ((CamelLocalSummary *)cls)->folder_path, - g_strerror (errno), tmpnam); - close(fdout); - tmpname = NULL; - fdout = -1; + g_strerror (errno), tmpname); + tmpname[0] = '\0'; fd = -1; goto error; } close(fdout); - unlink(tmpname); + + if (tmpname[0] != '\0') + unlink(tmpname); camel_operation_end(NULL); @@ -298,7 +287,7 @@ spool_summary_sync_full(CamelMboxSummary *cls, gboolean expunge, CamelFolderChan if (fdout != -1) close(fdout); - if (tmpname) + if (tmpname[0] != '\0') unlink(tmpname); camel_operation_end(NULL); diff --git a/camel/providers/nntp/ChangeLog b/camel/providers/nntp/ChangeLog index 8cf357f3e..419760580 100644 --- a/camel/providers/nntp/ChangeLog +++ b/camel/providers/nntp/ChangeLog @@ -1,3 +1,7 @@ +2007-05-14 Jules Colding <colding@omesc.com> + + * camel-nntp-newsrc.c (camel_nntp_newsrc_read_for_server): Fix file descriptor leak + 2007-04-05 Ross Burton <ross@openedhand.com> * camel-nntp-folder.c: (camel_nntp_folder_new): diff --git a/camel/providers/nntp/camel-nntp-newsrc.c b/camel/providers/nntp/camel-nntp-newsrc.c index f975808e6..140b79a1c 100644 --- a/camel/providers/nntp/camel-nntp-newsrc.c +++ b/camel/providers/nntp/camel-nntp-newsrc.c @@ -622,6 +622,7 @@ camel_nntp_newsrc_read_for_server (const char *server) if (fstat (fd, &sb) == -1) { g_warning ("failed fstat on ~/.newsrc-%s: %s\n", server, strerror(errno)); + close (fd); return newsrc; } newsrc_len = sb.st_size; diff --git a/camel/tests/ChangeLog b/camel/tests/ChangeLog index 4aea59a49..2c5e8ef0b 100644 --- a/camel/tests/ChangeLog +++ b/camel/tests/ChangeLog @@ -1,3 +1,9 @@ +2007-05-14 Jules Colding <colding@omesc.com> + + * mime-filter/test-charset.c (main): Check return value + + * message/test2.c (convert): Check return value + 2006-06-22 Harish Krishnaswamy <kharish@novell.com> * Makefile.am: Remove CVS/*, .cvsignore files from diff --git a/camel/tests/message/test2.c b/camel/tests/message/test2.c index 4584eace6..d8659a074 100644 --- a/camel/tests/message/test2.c +++ b/camel/tests/message/test2.c @@ -52,6 +52,9 @@ static char *convert(const char *in, const char *from, const char *to) char *nout, *noutp; iconv_t ic = iconv_open(from, to); + if (ic == (iconv_t)-1) + goto fail; + inp = out; inlen = strlen(out); outlen = inlen*5 + 16; @@ -68,6 +71,7 @@ static char *convert(const char *in, const char *from, const char *to) printf("Camel thinks the best encoding of '%s' is %s, although we converted from %s\n", in, camel_charset_best(out, strlen(out)), from); } +fail: #endif return out; diff --git a/camel/tests/mime-filter/test-charset.c b/camel/tests/mime-filter/test-charset.c index e568c9f4f..f928c15d9 100644 --- a/camel/tests/mime-filter/test-charset.c +++ b/camel/tests/mime-filter/test-charset.c @@ -36,6 +36,8 @@ main (int argc, char **argv) camel_test_init(argc, argv); dir = opendir (SOURCEDIR); + if (!dir) + return 1; while ((dent = readdir (dir))) { char *infile, *outfile, *charset, *work; diff --git a/configure.in b/configure.in index 9f6cde795..86d054793 100644 --- a/configure.in +++ b/configure.in @@ -707,8 +707,6 @@ else fi -AC_CHECK_FUNCS(mkstemp mkdtemp isblank) - dnl ************************************************** dnl ctime_r prototype dnl ************************************************** diff --git a/libedataserver/e-db3-utils.c b/libedataserver/e-db3-utils.c index 99dffa878..e9bd96fc8 100644 --- a/libedataserver/e-db3-utils.c +++ b/libedataserver/e-db3-utils.c @@ -83,11 +83,10 @@ cp_file (const char *src, const char *dest) place += count; } } - if (close (i)) - return -1; - if (close (o)) - return -1; - return 0; + i = close (i); + if (close (o) == -1) + i = -1; + return (i == -1) ? -1 : 0; } static int @@ -98,10 +97,7 @@ touch_file (const char *file) if (o == -1) return -1; - if (close (o) == -1) - return -1; - - return 0; + return close (o); } static int diff --git a/libedataserver/e-xml-utils.c b/libedataserver/e-xml-utils.c index 836f80718..c05da1603 100644 --- a/libedataserver/e-xml-utils.c +++ b/libedataserver/e-xml-utils.c @@ -107,7 +107,7 @@ e_xml_save_file (const char *filename, xmlDocPtr doc) errno = errnosave; return -1; } - + while ((ret = close (fd)) == -1 && errno == EINTR) ; diff --git a/libedataserver/md5-utils.c b/libedataserver/md5-utils.c index 29d5672e4..a78a4b8fd 100644 --- a/libedataserver/md5-utils.c +++ b/libedataserver/md5-utils.c @@ -340,7 +340,7 @@ md5_get_digest_from_file (const gchar *filename, guchar digest[16]) md5_init (&ctx); fp = g_fopen(filename, "rb"); if (!fp) { - return; + return; } while ((nb_bytes_read = fread (tmp_buf, 1, sizeof (tmp_buf), fp)) > 0) @@ -350,7 +350,7 @@ md5_get_digest_from_file (const gchar *filename, guchar digest[16]) fclose(fp); return; } - + fclose(fp); md5_final (&ctx, digest); } |
