guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

01/01: gnu: ola: Fix build failure caused by use of deprecated function.


From: Leo Famulari
Subject: 01/01: gnu: ola: Fix build failure caused by use of deprecated function.
Date: Fri, 4 Nov 2016 05:44:58 +0000 (UTC)

lfam pushed a commit to branch core-updates
in repository guix.

commit 8d806cb0e0853add2527b09b5e608c860faffe07
Author: Leo Famulari <address@hidden>
Date:   Fri Nov 4 01:17:31 2016 -0400

    gnu: ola: Fix build failure caused by use of deprecated function.
    
    * gnu/packages/patches/ola-readdir-r.patch: New file.
    * gnu/local.mk (dist_patch_DATA): Add it.
    * gnu/packages/lighting.scm (ola)[source]: Use it.
---
 gnu/local.mk                             |    1 +
 gnu/packages/lighting.scm                |    2 +
 gnu/packages/patches/ola-readdir-r.patch |   62 ++++++++++++++++++++++++++++++
 3 files changed, 65 insertions(+)

diff --git a/gnu/local.mk b/gnu/local.mk
index a448ccb..49f53e6 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -730,6 +730,7 @@ dist_patch_DATA =                                           
\
   %D%/packages/patches/nvi-db4.patch                           \
   %D%/packages/patches/ocaml-CVE-2015-8869.patch               \
   %D%/packages/patches/ocaml-findlib-make-install.patch        \
+  %D%/packages/patches/ola-readdir-r.patch                     \
   %D%/packages/patches/onionshare-fix-install-paths.patch              \
   %D%/packages/patches/openexr-missing-samples.patch           \
   %D%/packages/patches/openjpeg-CVE-2015-6581.patch            \
diff --git a/gnu/packages/lighting.scm b/gnu/packages/lighting.scm
index 5101fba..e70b276 100644
--- a/gnu/packages/lighting.scm
+++ b/gnu/packages/lighting.scm
@@ -21,6 +21,7 @@
   #:use-module (guix download)
   #:use-module ((guix licenses) #:prefix license:)
   #:use-module (guix packages)
+  #:use-module (gnu packages)
   #:use-module (gnu packages bison)
   #:use-module (gnu packages check)
   #:use-module (gnu packages compression)
@@ -41,6 +42,7 @@
               (uri (string-append
                     
"https://github.com/OpenLightingProject/ola/releases/download/";
                     version "/ola-" version ".tar.gz"))
+              (patches (search-patches "ola-readdir-r.patch"))
               (sha256
                (base32
                 "09zx1c8nkj29shfdzkahrh9397m3mwnsy0gj7jrb63f89f3n2vlq"))))
diff --git a/gnu/packages/patches/ola-readdir-r.patch 
b/gnu/packages/patches/ola-readdir-r.patch
new file mode 100644
index 0000000..b4bd981
--- /dev/null
+++ b/gnu/packages/patches/ola-readdir-r.patch
@@ -0,0 +1,62 @@
+Fix build failure caused by use of the deprecated readdir_r(3) while
+building with -Werror=deprecated-declarations
+
+Patch copied from upstream source repository:
+https://github.com/daveol/ola/commit/9d8575ff38f76df698ea8889e07a3dee8f21bd68
+
+From 9d8575ff38f76df698ea8889e07a3dee8f21bd68 Mon Sep 17 00:00:00 2001
+From: Dave Olsthoorn <address@hidden>
+Date: Wed, 2 Mar 2016 11:22:17 +0100
+Subject: [PATCH] Use readdir instead of readdir_r
+
+This replacec the use of readdir_r with readdir since readdir seems to
+be both dangarous and deprecated in newer versions of glibc.
+
+This fixes #1055
+---
+ common/file/Util.cpp | 17 ++++++++---------
+ 1 file changed, 8 insertions(+), 9 deletions(-)
+
+diff --git a/common/file/Util.cpp b/common/file/Util.cpp
+index e2261fd..0ffddd3 100644
+--- a/common/file/Util.cpp
++++ b/common/file/Util.cpp
+@@ -128,30 +128,29 @@ bool FindMatchingFiles(const string &directory,
+   FindClose(h_find);
+ #else
+   DIR *dp;
+-  struct dirent dir_ent;
+-  struct dirent *dir_ent_p;
++  struct dirent *dir_ent;
+   if ((dp = opendir(directory.data())) == NULL) {
+     OLA_WARN << "Could not open " << directory << ":" << strerror(errno);
+     return false;
+   }
+ 
+-  if (readdir_r(dp, &dir_ent, &dir_ent_p)) {
+-    OLA_WARN << "readdir_r(" << directory << "): " << strerror(errno);
++  if ((dir_ent = readdir(dp)) == NULL) {
++    OLA_WARN << "readdir(" << directory << "): " << strerror(errno);
+     closedir(dp);
+     return false;
+   }
+ 
+-  while (dir_ent_p != NULL) {
++  while (dir_ent != NULL) {
+     vector<string>::const_iterator iter;
+     for (iter = prefixes.begin(); iter != prefixes.end(); ++iter) {
+-      if (!strncmp(dir_ent_p->d_name, iter->data(), iter->size())) {
++      if (!strncmp(dir_ent->d_name, iter->data(), iter->size())) {
+         std::ostringstream str;
+-        str << directory << PATH_SEPARATOR << dir_ent_p->d_name;
++        str << directory << PATH_SEPARATOR << dir_ent->d_name;
+         files->push_back(str.str());
+       }
+     }
+-    if (readdir_r(dp, &dir_ent, &dir_ent_p)) {
+-      OLA_WARN << "readdir_r(" << directory << "): " << strerror(errno);
++    if ((dir_ent = readdir(dp)) == NULL) {
++      OLA_WARN << "readdir(" << directory << "): " << strerror(errno);
+       closedir(dp);
+       return false;
+     }



reply via email to

[Prev in Thread] Current Thread [Next in Thread]