[SCM] exiv2 packaging branch, master, updated. debian/0.25-3.1-3734-gdcbc29a

Maximiliano Curia maxy at moszumanska.debian.org
Thu Jul 13 17:40:17 UTC 2017


Gitweb-URL: http://git.debian.org/?p=pkg-kde/kde-extras/exiv2.git;a=commitdiff;h=105a4e4

The following commit has been merged in the master branch:
commit 105a4e417deff3e9bbd3f819c03013511f47d2b6
Author: Andreas Huggel <ahuggel at gmx.net>
Date:   Tue Dec 30 15:54:46 2008 +0000

    Changed FileIo::transfer to only write a warning if changing file permissions fails and fixed the use of strerror_r. Fixes digiKam bug 178103.
---
 src/basicio.cpp | 29 +++++++++++++++++++++++------
 src/error.cpp   |  2 +-
 src/futils.cpp  |  5 +++--
 3 files changed, 27 insertions(+), 9 deletions(-)

diff --git a/src/basicio.cpp b/src/basicio.cpp
index 20797fc..10d7ae2 100644
--- a/src/basicio.cpp
+++ b/src/basicio.cpp
@@ -44,6 +44,7 @@ EXIV2_RCSID("@(#) $Id$")
 // + standard includes
 #include <string>
 #include <memory>
+#include <iostream>
 #include <cstring>
 #include <cassert>
 #include <cstdio>                       // for remove, rename
@@ -230,9 +231,13 @@ namespace Exiv2 {
                 throw Error(10, path_, "w+b", strError());
             }
             close();
-            struct stat buf;
-            if (::stat(path_.c_str(), &buf) == -1) {
-                throw Error(2, path_, strError(), "stat");
+            bool statOk = true;
+            struct stat buf1;
+            if (::stat(path_.c_str(), &buf1) == -1) {
+                statOk = false;
+#ifndef SUPPRESS_WARNINGS
+                std::cerr << "Warning: " << Error(2, path_, strError(), "stat") << "
";
+#endif
             }
             // MSVCRT rename that does not overwrite existing files
             if (fileExists(path_) && std::remove(path_.c_str()) != 0) {
@@ -242,9 +247,21 @@ namespace Exiv2 {
                 throw Error(17, fileIo->path_, path_, strError());
             }
             std::remove(fileIo->path_.c_str());
-            // Set original file permissions
-            if (::chmod(path_.c_str(), buf.st_mode) == -1) {
-                throw Error(2, fileIo->path_, strError(), "chmod");
+            // Check permissions of new file
+            struct stat buf2;
+            if (statOk && ::stat(path_.c_str(), &buf2) == -1) {
+                statOk = false;
+#ifndef SUPPRESS_WARNINGS
+                std::cerr << "Warning: " << Error(2, path_, strError(), "stat") << "
";
+#endif
+            }
+            if (statOk && buf1.st_mode != buf2.st_mode) {
+                // Set original file permissions
+                if (::chmod(path_.c_str(), buf1.st_mode) == -1) {
+#ifndef SUPPRESS_WARNINGS
+                    std::cerr << "Warning: " << Error(2, path_, strError(), "chmod") << "
";
+#endif
+                }
             }
         }
         else {
diff --git a/src/error.cpp b/src/error.cpp
index f0a3ae0..4d5b1f1 100644
--- a/src/error.cpp
+++ b/src/error.cpp
@@ -49,7 +49,7 @@ namespace {
         { -1, N_("Error %0: arg1=%1, arg2=%2, arg3=%3.") },
         {  0, N_("Success") },
         {  1, "%1" }, // %1=error message
-        {  2, "%1: %2 (%3)" }, // %1=path, %2=strerror, %3=function that failed
+        {  2, "%1: Call to `%3' failed: %2" }, // %1=path, %2=strerror, %3=function that failed
         {  3, N_("This does not look like a %1 image") }, // %1=Image type
         {  4, N_("Invalid dataset name `%1'") }, // %1=dataset name
         {  5, N_("Invalid record name `%1'") }, // %1=record name
diff --git a/src/futils.cpp b/src/futils.cpp
index 10c495a..acc76bc 100644
--- a/src/futils.cpp
+++ b/src/futils.cpp
@@ -81,7 +81,8 @@ namespace Exiv2 {
         std::ostringstream os;
 #ifdef EXV_HAVE_STRERROR_R
         const size_t n = 1024;
-# ifdef EXV_STRERROR_R_CHAR_P
+// _GNU_SOURCE: See Debian bug #485135
+# if defined EXV_STRERROR_R_CHAR_P || defined _GNU_SOURCE
         char *buf = 0;
         char buf2[n];
         std::memset(buf2, 0x0, n);
@@ -95,7 +96,7 @@ namespace Exiv2 {
 #else
         os << std::strerror(error);
 #endif
-        os << " (" << error << ")";
+        os << " (errno = " << error << ")";
         return os.str();
     } // strError
 

-- 
exiv2 packaging



More information about the pkg-kde-commits mailing list