[Commits] [SCM] claws branch, master, updated. 3.14.1-124-g1ee234f

wwp at claws-mail.org wwp at claws-mail.org
Thu Jan 12 16:32:59 CET 2017


The branch, master has been updated
       via  1ee234f75c32179a487d1946ddf08dc1033ff1c5 (commit)
      from  77e2223bbbf70a9863512b45b3d3df18f68cbbaa (commit)

Summary of changes:
 src/common/utils.c                       |    4 ++--
 src/crash.c                              |    2 +-
 src/partial_download.c                   |    8 ++++----
 src/plugins/archive/archiver_gtk.c       |    5 +++--
 src/plugins/archive/libarchive_archive.c |   10 +++++-----
 src/plugins/mailmbox/maillock.c          |   14 +++++++++-----
 src/plugins/pgpinline/pgpinline.c        |    2 +-
 src/plugins/pgpmime/pgpmime.c            |    2 ++
 src/plugins/smime/smime.c                |    6 +++---
 src/plugins/vcalendar/vcal_meeting_gtk.c |    6 +++---
 src/procmime.c                           |    8 ++++----
 11 files changed, 37 insertions(+), 30 deletions(-)


- Log -----------------------------------------------------------------
commit 1ee234f75c32179a487d1946ddf08dc1033ff1c5
Author: wwp <wwp at free.fr>
Date:   Thu Jan 12 16:31:10 2017 +0100

    Add context missing info to few system call errors (mostly:
    file operations).

diff --git a/src/common/utils.c b/src/common/utils.c
index 1a66212..10c3764 100644
--- a/src/common/utils.c
+++ b/src/common/utils.c
@@ -5385,7 +5385,7 @@ get_random_bytes(void *buf, size_t count)
 
 	rnd = open("/dev/urandom", O_RDONLY);
 	if (rnd == -1) {
-		perror("open on /dev/urandom");
+		FILE_OP_ERROR("/dev/urandom", "open");
 		debug_print("Could not open /dev/urandom.\n");
 		return FALSE;
 	}
@@ -5401,7 +5401,7 @@ get_random_bytes(void *buf, size_t count)
 #else
 	ret = read(rnd, buf, count);
 	if (ret != count) {
-		perror("read from /dev/urandom");
+		FILE_OP_ERROR("/dev/urandom", "read");
 		debug_print("Could not read enough data from /dev/urandom, read only %ld of %lu bytes.\n", ret, count);
 		close(rnd);
 		return FALSE;
diff --git a/src/crash.c b/src/crash.c
index 3869581..a484012 100644
--- a/src/crash.c
+++ b/src/crash.c
@@ -541,7 +541,7 @@ static void crash_handler(int sig)
 		args[4] = NULL;
 
 		if (chdir(claws_get_startup_dir()) != 0)
-			perror("chdir");
+			FILE_OP_ERROR(claws_get_startup_dir(), "chdir");
 		if (setgid(getgid()) != 0)
 			perror("setgid");
 		if (setuid(getuid()) != 0 )
diff --git a/src/partial_download.c b/src/partial_download.c
index 5694b0d..d59ae80 100644
--- a/src/partial_download.c
+++ b/src/partial_download.c
@@ -171,7 +171,7 @@ static int partial_uidl_mark_mail(MsgInfo *msginfo, int download)
 			   "-", sanitized_uid, NULL);
 
 	if ((fp = g_fopen(path, "rb")) == NULL) {
-		perror("fopen1");
+		FILE_OP_ERROR(path, "fopen");
 		if (ENOENT != errno) FILE_OP_ERROR(path, "fopen");
 		g_free(path);
 		path = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S,
@@ -191,7 +191,7 @@ static int partial_uidl_mark_mail(MsgInfo *msginfo, int download)
 	g_free(sanitized_uid);
 
 	if ((fpnew = g_fopen(pathnew, "wb")) == NULL) {
-		perror("fopen2");
+		FILE_OP_ERROR(pathnew, "fopen");
 		fclose(fp);
 		g_free(pathnew);
 		goto bail;
@@ -263,12 +263,12 @@ static int partial_uidl_mark_mail(MsgInfo *msginfo, int download)
 	g_free(pathnew);
 	
 	if ((fp = g_fopen(filename,"rb")) == NULL) {
-		perror("fopen3");
+		FILE_OP_ERROR(filename, "fopen");
 		goto bail;
 	}
 	pathnew = g_strdup_printf("%s.new", filename);
 	if ((fpnew = g_fopen(pathnew, "wb")) == NULL) {
-		perror("fopen4");
+		FILE_OP_ERROR(pathnew, "fopen");
 		fclose(fp);
 		g_free(pathnew);
 		goto bail;
diff --git a/src/plugins/archive/archiver_gtk.c b/src/plugins/archive/archiver_gtk.c
index 55156ed..11c166f 100644
--- a/src/plugins/archive/archiver_gtk.c
+++ b/src/plugins/archive/archiver_gtk.c
@@ -313,6 +313,7 @@ static void create_md5sum(const gchar* file, const gchar* md5_file) {
 	debug_print("md5sum: %s\n", md5sum);
 	if ((fd = 
 		open(md5_file, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR)) == -1) {
+		FILE_OP_ERROR(md5_file, "create");
 		free(md5sum);
 		return;
 	}
@@ -326,7 +327,7 @@ static void create_md5sum(const gchar* file, const gchar* md5_file) {
 	g_free(md5sum);
 	debug_print("md5sum: %s\n", text);
 	if (write(fd, text, strlen(text)) < 0)
-		perror("write");
+		FILE_OP_ERROR(md5_file, "write");
 	close(fd);
 	g_free(text);
 }
@@ -388,7 +389,7 @@ static gchar* descriptive_file_name(
 	debug_print("New_file: %s\n", new_file);
 	if (link(file, new_file) != 0) {
 		if (errno != EEXIST) {
-			perror("link");
+			FILE_OP_ERROR(new_file, "link");
 			g_free(new_file);
 			new_file = g_strdup(file);
 			page->rename = FALSE;
diff --git a/src/plugins/archive/libarchive_archive.c b/src/plugins/archive/libarchive_archive.c
index a348c54..e7b3245 100644
--- a/src/plugins/archive/libarchive_archive.c
+++ b/src/plugins/archive/libarchive_archive.c
@@ -588,19 +588,19 @@ const gchar* archive_create(const char* archive_name, GSList* files,
 #endif
 			entry = archive_entry_new();
 			if ((fd = open(filename, O_RDONLY)) == -1) {
-				perror("open file");
+				FILE_OP_ERROR(filename, "open");
 			}
 			else {
 				if (lstat(filename, &st) == -1) {
-					perror("lstat file");
+					FILE_OP_ERROR(filename, "lstat");
 				} else {
 					archive_entry_copy_stat(entry, &st);
 					archive_entry_set_pathname(entry, filename);
 					if (S_ISLNK(st.st_mode)) {
 						if ((buf = malloc(PATH_MAX + 1)) != NULL) {
-							if ((len = readlink(filename, buf, PATH_MAX)) < 0)
-								perror("error in readlink");
-							else
+							if ((len = readlink(filename, buf, PATH_MAX)) < 0) {
+								FILE_OP_ERROR(filename, "readlink");
+							} else
 								buf[len] = '\0';
 							archive_entry_set_symlink(entry, buf);
 							g_free(buf);
diff --git a/src/plugins/mailmbox/maillock.c b/src/plugins/mailmbox/maillock.c
index 475070f..5c6e704 100644
--- a/src/plugins/mailmbox/maillock.c
+++ b/src/plugins/mailmbox/maillock.c
@@ -159,6 +159,7 @@ static int lock_common(const char * filename, int fd, short locktype)
   r = fcntl(fd, F_SETLKW, &lock);
   if (r < 0) {
     /* WARNING POSIX lock could not be applied */
+    perror("lock");
   }
 
   /* dot lock file */
@@ -175,7 +176,7 @@ static int lock_common(const char * filename, int fd, short locktype)
     int fd;
     GStatBuf st;
     time_t now;
-    
+
     /* global timeout */
     time(&now);
     if (now > start + LOCKTO_GLOB) {
@@ -187,14 +188,16 @@ static int lock_common(const char * filename, int fd, short locktype)
     if (fd >= 0) {
       /* defeat lock checking programs which test pid */
       if (write(fd, "0", 2) < 0)
-	      perror("write");
+          FILE_OP_ERROR(lockfilename, "write");
       close(fd);
       break;
+    } else {
+      FILE_OP_ERROR(lockfilename, "open");
     }
-    
+
     /* libEtPan! - adds a delay of 5 seconds between each tries */
     sleep(5);
-    
+
     if (g_stat(lockfilename, &st) < 0) {
       if (statfailed++ > 5) {
 	res = -1;
@@ -207,7 +210,7 @@ static int lock_common(const char * filename, int fd, short locktype)
 
     if (now < st.st_ctime + LOCKTO_RM)
       continue;
-    
+
     /* try to remove stale lockfile */
     if (unlink(lockfilename) < 0) {
       res = -1;
@@ -235,6 +238,7 @@ static int lock_common(const char * filename, int fd, short locktype)
   r = fcntl(fd, F_SETLK, &lock);
   if (r < 0) {
     /* WARNING POSIX lock could not be applied */
+    perror("lock");
   }
   return res;
 }
diff --git a/src/plugins/pgpinline/pgpinline.c b/src/plugins/pgpinline/pgpinline.c
index 5c1c1d3..6ebb883 100644
--- a/src/plugins/pgpinline/pgpinline.c
+++ b/src/plugins/pgpinline/pgpinline.c
@@ -500,7 +500,7 @@ static gboolean pgpinline_sign(MimeInfo *mimeinfo, PrefsAccount *account, const
 	fp = my_tmpfile();
 	if (fp == NULL) {
 		perror("my_tmpfile");
-		privacy_set_error(_("Couldn't create temporary file."));
+		privacy_set_error(_("Couldn't create temporary file, %s"), g_strerror(errno));
 		return FALSE;
 	}
 	procmime_write_mimeinfo(msgcontent, fp);
diff --git a/src/plugins/pgpmime/pgpmime.c b/src/plugins/pgpmime/pgpmime.c
index 837e379..e14ebe0 100644
--- a/src/plugins/pgpmime/pgpmime.c
+++ b/src/plugins/pgpmime/pgpmime.c
@@ -452,6 +452,7 @@ gboolean pgpmime_sign(MimeInfo *mimeinfo, PrefsAccount *account, const gchar *fr
 	
 	fp = my_tmpfile();
 	if (fp == NULL) {
+		perror("my_tmpfile");
 		privacy_set_error(_("Couldn't create temporary file: %s"), g_strerror(errno));
 		return FALSE;
 	}
@@ -688,6 +689,7 @@ gboolean pgpmime_encrypt(MimeInfo *mimeinfo, const gchar *encrypt_data)
 	/* write message content to temporary file */
 	fp = my_tmpfile();
 	if (fp == NULL) {
+		perror("my_tmpfile");
 		privacy_set_error(_("Couldn't create temporary file, %s"), g_strerror(errno));
 		g_free(kset);
 		return FALSE;
diff --git a/src/plugins/smime/smime.c b/src/plugins/smime/smime.c
index 03ed669..7e3af5e 100644
--- a/src/plugins/smime/smime.c
+++ b/src/plugins/smime/smime.c
@@ -793,7 +793,7 @@ gboolean smime_encrypt(MimeInfo *mimeinfo, const gchar *encrypt_data)
 	tmpfile = get_tmp_file();
 	fp = g_fopen(tmpfile, "wb");
 	if (fp == NULL) {
-		perror("get_tmp_file");
+		FILE_OP_ERROR(tmpfile, "create");
 		g_free(kset);
 		return FALSE;
 	}
@@ -804,7 +804,7 @@ gboolean smime_encrypt(MimeInfo *mimeinfo, const gchar *encrypt_data)
 	canonicalize_file_replace(tmpfile);
 	fp = g_fopen(tmpfile, "rb");
 	if (fp == NULL) {
-		perror("get_tmp_file");
+		FILE_OP_ERROR(tmpfile, "open");
 		g_free(kset);
 		return FALSE;
 	}
@@ -850,7 +850,7 @@ gboolean smime_encrypt(MimeInfo *mimeinfo, const gchar *encrypt_data)
 			return FALSE;
 		}
 	} else {
-		perror("get_tmp_file");
+		FILE_OP_ERROR(tmpfile, "create");
 		g_free(tmpfile);
 		g_free(enccontent);
 		return FALSE;
diff --git a/src/plugins/vcalendar/vcal_meeting_gtk.c b/src/plugins/vcalendar/vcal_meeting_gtk.c
index 99e43fd..a4a99d0 100644
--- a/src/plugins/vcalendar/vcal_meeting_gtk.c
+++ b/src/plugins/vcalendar/vcal_meeting_gtk.c
@@ -1981,13 +1981,13 @@ void multisync_export(void)
 		for (cur = files; cur; cur = cur->next) {
 			file = (char *)cur->data;
 			if (fprintf(fp, "1 1 %s\n", file) < 0)
-				perror(file);
+				FILE_OP_ERROR(file, "fprintf");
 			g_free(file);
 		}
 		if (fclose(fp) == EOF)
-			perror(file);
+			FILE_OP_ERROR(file, "fclose");
 	} else {
-		perror(file);
+		FILE_OP_ERROR(file, "fopen");
 	}
 	g_free(path);
 	g_slist_free(files);
diff --git a/src/procmime.c b/src/procmime.c
index c29da8c..e41394d 100644
--- a/src/procmime.c
+++ b/src/procmime.c
@@ -359,11 +359,11 @@ gboolean procmime_decode_content(MimeInfo *mimeinfo)
 
 	infp = procmime_fopen(mimeinfo->data.filename, "rb");
 	if (!infp) {
-		perror("fopen");
+		FILE_OP_ERROR(mimeinfo->data.filename, "fopen");
 		return FALSE;
 	}
 	if (fseek(infp, mimeinfo->offset, SEEK_SET) < 0) {
-		perror("fseek");
+		FILE_OP_ERROR(mimeinfo->data.filename, "fseek");
 		procmime_fclose(infp);
 		return FALSE;
 	}
@@ -408,7 +408,7 @@ gboolean procmime_decode_content(MimeInfo *mimeinfo)
 			uncanonicalize = TRUE;
 			tmpfp = my_tmpfile();
 			if (!tmpfp) {
-				perror("tmpfile");
+				perror("my_tmpfile");
 				if (tmp_file) 
 					procmime_fclose(outfp);
 				procmime_fclose(infp);
@@ -861,7 +861,7 @@ FILE *procmime_get_text_content(MimeInfo *mimeinfo)
 	gboolean err;
 
 	if ((outfp = my_tmpfile()) == NULL) {
-		perror("tmpfile");
+		perror("my_tmpfile");
 		return NULL;
 	}
 #ifdef HAVE_FGETS_UNLOCKED

-----------------------------------------------------------------------


hooks/post-receive
-- 
Claws Mail


More information about the Commits mailing list