[Commits] [SCM] claws branch, master, updated. 3.16.0-207-gc69dcb6

wwp at claws-mail.org wwp at claws-mail.org
Mon Jun 11 13:36:45 CEST 2018


The branch, master has been updated
       via  c69dcb6b3ccb4fe9af6d5ed729936a8f17c34d22 (commit)
      from  1d0409a41f55b3bf6e05a9f2a1a79643b8b62121 (commit)

Summary of changes:
 src/plugins/archive/archiver.c           |    2 +-
 src/plugins/archive/archiver.h           |    2 +-
 src/plugins/archive/archiver_gtk.c       |    2 +-
 src/plugins/archive/archiver_prefs.c     |    2 +-
 src/plugins/archive/archiver_prefs.h     |    2 +-
 src/plugins/archive/libarchive_archive.c |   32 ++++++++++++++++++------------
 src/plugins/archive/libarchive_archive.h |    2 +-
 7 files changed, 25 insertions(+), 19 deletions(-)


- Log -----------------------------------------------------------------
commit c69dcb6b3ccb4fe9af6d5ed729936a8f17c34d22
Author: wwp <wwp at free.fr>
Date:   Mon Jun 11 13:36:12 2018 +0200

    Update copyright in file headers.
    Make use of GLib API for few file operations.

diff --git a/src/plugins/archive/archiver.c b/src/plugins/archive/archiver.c
index cf689de..2a8dad5 100644
--- a/src/plugins/archive/archiver.c
+++ b/src/plugins/archive/archiver.c
@@ -2,7 +2,7 @@
 
 /*
  * Claws Mail -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2017 Michael Rasmussen and the Claws Mail Team
+ * Copyright (C) 1999-2018 Michael Rasmussen and the Claws Mail Team
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
diff --git a/src/plugins/archive/archiver.h b/src/plugins/archive/archiver.h
index 4405547..42fde0b 100644
--- a/src/plugins/archive/archiver.h
+++ b/src/plugins/archive/archiver.h
@@ -2,7 +2,7 @@
 
 /*
  * Claws Mail -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2017 Michael Rasmussen and the Claws Mail Team
+ * Copyright (C) 1999-2018 Michael Rasmussen and the Claws Mail Team
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
diff --git a/src/plugins/archive/archiver_gtk.c b/src/plugins/archive/archiver_gtk.c
index c798253..27ff539 100644
--- a/src/plugins/archive/archiver_gtk.c
+++ b/src/plugins/archive/archiver_gtk.c
@@ -2,7 +2,7 @@
 
 /*
  * Claws Mail -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2017 Michael Rasmussen and the Claws Mail Team
+ * Copyright (C) 1999-2018 Michael Rasmussen and the Claws Mail Team
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
diff --git a/src/plugins/archive/archiver_prefs.c b/src/plugins/archive/archiver_prefs.c
index fdda401..826630a 100644
--- a/src/plugins/archive/archiver_prefs.c
+++ b/src/plugins/archive/archiver_prefs.c
@@ -1,6 +1,6 @@
 /*
  * Claws Mail -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2017 Michael Rasmussen and the Claws Mail Team
+ * Copyright (C) 1999-2018 Michael Rasmussen and the Claws Mail Team
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
diff --git a/src/plugins/archive/archiver_prefs.h b/src/plugins/archive/archiver_prefs.h
index 159b3c1..4da8c73 100644
--- a/src/plugins/archive/archiver_prefs.h
+++ b/src/plugins/archive/archiver_prefs.h
@@ -1,6 +1,6 @@
 /*
  * Claws Mail -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2017 Michael Rasmussen and the Claws Mail Team
+ * Copyright (C) 1999-2018 Michael Rasmussen and the Claws Mail Team
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
diff --git a/src/plugins/archive/libarchive_archive.c b/src/plugins/archive/libarchive_archive.c
index cc1c95c..7ee669b 100644
--- a/src/plugins/archive/libarchive_archive.c
+++ b/src/plugins/archive/libarchive_archive.c
@@ -1,6 +1,6 @@
 /*
  * Claws Mail -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2017 Michael Rasmussen and the Claws Mail Team
+ * Copyright (C) 1999-2018 Michael Rasmussen and the Claws Mail Team
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -445,7 +445,6 @@ const gchar* archive_create(const char* archive_name, GSList* files,
 	char* buf = NULL;
 	ssize_t len;
 	int fd;
-	struct stat st;
 	struct file_info* file;
 	gchar* filename = NULL;
 	gchar* msg = NULL;
@@ -580,6 +579,9 @@ const gchar* archive_create(const char* archive_name, GSList* files,
 #endif
 		}
 		else {
+			GError* err = NULL;
+			GStatBuf st;
+
 #ifndef _TEST
 			debug_print("Adding: %s\n", filename);
 			msg = g_strdup_printf("%s", filename);
@@ -587,21 +589,21 @@ const gchar* archive_create(const char* archive_name, GSList* files,
 			g_free(msg);
 #endif
 			entry = archive_entry_new();
-			if ((fd = open(filename, O_RDONLY)) == -1) {
-				FILE_OP_ERROR(filename, "open");
+			if ((fd = g_open(filename, O_RDONLY, 0)) == -1) {
+				FILE_OP_ERROR(filename, "g_open");
 			}
 			else {
-				if (lstat(filename, &st) == -1) {
-					FILE_OP_ERROR(filename, "lstat");
+				if (g_stat(filename, &st) == -1) {
+					FILE_OP_ERROR(filename, "g_stat");
 				} 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) {
-								FILE_OP_ERROR(filename, "readlink");
-							} else
-								buf[len] = '\0';
+
+						buf = g_file_read_link(filename, &err);
+						if (err) {
+							FILE_OP_ERROR(filename, "g_file_read_link");
+						} else {
 							archive_entry_set_symlink(entry, buf);
 							g_free(buf);
 							archive_entry_set_size(entry, 0);
@@ -623,7 +625,8 @@ const gchar* archive_create(const char* archive_name, GSList* files,
 						}
 					}
 				}
-				close(fd);
+				if (!g_close(fd, &err) || err)
+					FILE_OP_ERROR(filename, "g_close");
 				archive_entry_free(entry);
 			}
 		}
@@ -665,7 +668,10 @@ void archive_scan_folder(const char* dir) {
 	while ((ent = readdir(root)) != NULL) {
 		if (strcmp(".", ent->d_name) == 0 || strcmp("..", ent->d_name) == 0)
 			continue;
-		g_stat(ent->d_name, &st);
+		if (g_stat(ent->d_name, &st) == -1) {
+			FILE_OP_ERROR(filename, "g_stat");
+			continue;
+		}
 		sprintf(path, "%s/%s", dir, ent->d_name);
 		if (S_ISREG(st.st_mode) || S_ISLNK(st.st_mode)) {
 			archive_add_file(path);
diff --git a/src/plugins/archive/libarchive_archive.h b/src/plugins/archive/libarchive_archive.h
index 60207bc..4ceb2fe 100644
--- a/src/plugins/archive/libarchive_archive.h
+++ b/src/plugins/archive/libarchive_archive.h
@@ -2,7 +2,7 @@
 
 /*
  * Claws Mail -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2017 Michael Rasmussen and the Claws Mail Team
+ * Copyright (C) 1999-2018 Michael Rasmussen and the Claws Mail Team
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by

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


hooks/post-receive
-- 
Claws Mail


More information about the Commits mailing list