Hello community, here is the log from the commit of package libgpiod for openSUSE:Factory checked in at 2020-04-18 00:32:58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/libgpiod (Old) and /work/SRC/openSUSE:Factory/.libgpiod.new.2738 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "libgpiod" Sat Apr 18 00:32:58 2020 rev:12 rq:794919 version:1.4.3 Changes: -------- --- /work/SRC/openSUSE:Factory/libgpiod/libgpiod.changes 2020-03-20 23:59:52.969040379 +0100 +++ /work/SRC/openSUSE:Factory/.libgpiod.new.2738/libgpiod.changes 2020-04-18 00:33:49.114473264 +0200 @@ -1,0 +2,7 @@ +Fri Apr 17 12:54:32 UTC 2020 - Guillaume GARDET <[email protected]> + +- Update to v1.4.3: + * Bug fixes: + - relax gpiod_chip_open() for symbolic links + +------------------------------------------------------------------- Old: ---- libgpiod-1.4.2.tar.gz New: ---- libgpiod-1.4.3.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ libgpiod.spec ++++++ --- /var/tmp/diff_new_pack.dfSyvr/_old 2020-04-18 00:33:49.730474540 +0200 +++ /var/tmp/diff_new_pack.dfSyvr/_new 2020-04-18 00:33:49.730474540 +0200 @@ -26,7 +26,7 @@ %bcond_with libgpiod_tests %endif Name: libgpiod -Version: 1.4.2 +Version: 1.4.3 Release: 0 Summary: C library and tools for interacting with the linux GPIO character device License: LGPL-2.1-or-later ++++++ libgpiod-1.4.2.tar.gz -> libgpiod-1.4.3.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libgpiod-1.4.2/NEWS new/libgpiod-1.4.3/NEWS --- old/libgpiod-1.4.2/NEWS 2020-01-27 17:35:09.000000000 +0100 +++ new/libgpiod-1.4.3/NEWS 2020-03-31 10:26:46.000000000 +0200 @@ -1,3 +1,9 @@ +libgpiod v1.4.3 +=============== + +Bug fixes: +- relax gpiod_chip_open() for symbolic links + libgpiod v1.4.2 =============== diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libgpiod-1.4.2/configure.ac new/libgpiod-1.4.3/configure.ac --- old/libgpiod-1.4.2/configure.ac 2020-01-27 17:35:09.000000000 +0100 +++ new/libgpiod-1.4.3/configure.ac 2020-03-31 10:26:46.000000000 +0200 @@ -8,7 +8,7 @@ AC_PREREQ(2.61) -AC_INIT([libgpiod], 1.4.2) +AC_INIT([libgpiod], 1.4.3) AC_SUBST(EXTRA_VERSION, []) AC_DEFINE_UNQUOTED([GPIOD_VERSION_STR], @@ -30,7 +30,7 @@ # # Define the libtool version as (C.R.A): # NOTE: this version only applies to the core C library. -AC_SUBST(ABI_VERSION, [3.2.1]) +AC_SUBST(ABI_VERSION, [3.3.1]) # Have a separate ABI version for C++ bindings: AC_SUBST(ABI_CXX_VERSION, [1.4.0]) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libgpiod-1.4.2/lib/core.c new/libgpiod-1.4.3/lib/core.c --- old/libgpiod-1.4.2/lib/core.c 2020-01-27 17:35:09.000000000 +0100 +++ new/libgpiod-1.4.3/lib/core.c 2020-03-31 10:26:46.000000000 +0200 @@ -10,6 +10,7 @@ #include <errno.h> #include <fcntl.h> #include <gpiod.h> +#include <limits.h> #include <linux/gpio.h> #include <poll.h> #include <stdint.h> @@ -62,7 +63,7 @@ static bool is_gpiochip_cdev(const char *path) { - char *name, *pathcpy, *sysfsp, sysfsdev[16], devstr[16]; + char *name, *realname, *sysfsp, sysfsdev[16], devstr[16]; struct stat statbuf; bool ret = false; int rv, fd; @@ -72,6 +73,19 @@ if (rv) goto out; + /* + * Is it a symbolic link? We have to resolve symbolic link before + * checking the rest. + */ + realname = S_ISLNK(statbuf.st_mode) ? realpath(path, NULL) + : strdup(path); + if (realname == NULL) + goto out; + + rv = stat(realname, &statbuf); + if (rv) + goto out_free_realname; + /* Is it a character device? */ if (!S_ISCHR(statbuf.st_mode)) { /* @@ -81,20 +95,16 @@ * libgpiod from before the introduction of this routine. */ errno = ENOTTY; - goto out; + goto out_free_realname; } /* Get the basename. */ - pathcpy = strdup(path); - if (!pathcpy) - goto out; - - name = basename(pathcpy); + name = basename(realname); /* Do we have a corresponding sysfs attribute? */ rv = asprintf(&sysfsp, "/sys/bus/gpio/devices/%s/dev", name); if (rv < 0) - goto out_free_pathcpy; + goto out_free_realname; if (access(sysfsp, R_OK) != 0) { /* @@ -136,8 +146,8 @@ out_free_sysfsp: free(sysfsp); -out_free_pathcpy: - free(pathcpy); +out_free_realname: + free(realname); out: return ret; }
