144 lines
3.9 KiB
Diff
144 lines
3.9 KiB
Diff
From 7630389dcd3494c13b74b119cca37f97d2d8445a Mon Sep 17 00:00:00 2001
|
|
From: Panu Matilainen <pmatilai@redhat.com>
|
|
Date: Mon, 30 Mar 2020 11:29:19 +0300
|
|
Subject: [PATCH] Flush 1998 vintage dirent.h compatibility mess from system.h
|
|
|
|
dirent.h and struct dirent are actually standard on this millenium, the
|
|
only thing that isn't is d_type member for which we have and retain
|
|
a specific test in configure.ac. Include <dirent.h> where needed,
|
|
relatively few places do which makes it even a bigger insult to have
|
|
this included from system.h.
|
|
|
|
URL:https://github.com/rpm-software-management/rpm/commit/7630389dcd3494c13b74b119cca37f97d2d8445a
|
|
---
|
|
lib/backend/ndb/rpmpkg.c | 1 +
|
|
lib/backend/ndb/rpmxdb.c | 1 +
|
|
lib/rpmdb.c | 1 +
|
|
misc/fts.c | 1 +
|
|
rpmio/rpmglob.c | 5 ++---
|
|
rpmio/rpmio.c | 1 +
|
|
system.h | 17 -----------------
|
|
7 files changed, 7 insertions(+), 20 deletions(-)
|
|
|
|
diff --git a/lib/backend/ndb/rpmpkg.c b/lib/backend/ndb/rpmpkg.c
|
|
index b9cd67c..64d0493 100644
|
|
--- a/lib/backend/ndb/rpmpkg.c
|
|
+++ b/lib/backend/ndb/rpmpkg.c
|
|
@@ -11,6 +11,7 @@
|
|
#include <string.h>
|
|
#include <stdlib.h>
|
|
#include <libgen.h>
|
|
+#include <dirent.h>
|
|
|
|
#include "rpmpkg.h"
|
|
|
|
diff --git a/lib/backend/ndb/rpmxdb.c b/lib/backend/ndb/rpmxdb.c
|
|
index dbd4942..5136fbc 100644
|
|
--- a/lib/backend/ndb/rpmxdb.c
|
|
+++ b/lib/backend/ndb/rpmxdb.c
|
|
@@ -16,6 +16,7 @@
|
|
#include <sys/mman.h>
|
|
#include <endian.h>
|
|
#include <libgen.h>
|
|
+#include <dirent.h>
|
|
|
|
#include "rpmxdb.h"
|
|
|
|
diff --git a/lib/rpmdb.c b/lib/rpmdb.c
|
|
index 3035e63..57a3c3d 100644
|
|
--- a/lib/rpmdb.c
|
|
+++ b/lib/rpmdb.c
|
|
@@ -7,6 +7,7 @@
|
|
#include <sys/file.h>
|
|
#include <utime.h>
|
|
#include <errno.h>
|
|
+#include <dirent.h>
|
|
|
|
#ifndef DYING /* XXX already in "system.h" */
|
|
#include <fnmatch.h>
|
|
diff --git a/misc/fts.c b/misc/fts.c
|
|
index 5c6f53d..b43f261 100644
|
|
--- a/misc/fts.c
|
|
+++ b/misc/fts.c
|
|
@@ -68,6 +68,7 @@ static char sccsid[] = "@(#)fts.c 8.6 (Berkeley) 8/14/94";
|
|
#include "system.h"
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
+#include <dirent.h>
|
|
#include <errno.h>
|
|
#include "misc/rpmfts.h"
|
|
# define __set_errno(val) (*__errno_location ()) = (val)
|
|
diff --git a/rpmio/rpmglob.c b/rpmio/rpmglob.c
|
|
index 3c497cb..93f7fa5 100644
|
|
--- a/rpmio/rpmglob.c
|
|
+++ b/rpmio/rpmglob.c
|
|
@@ -26,6 +26,7 @@
|
|
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
+#include <dirent.h>
|
|
#include <pwd.h>
|
|
#include <assert.h>
|
|
#include <sys/stat.h> /* S_ISDIR */
|
|
@@ -75,8 +76,6 @@ typedef struct {
|
|
int (*gl_stat)(const char *, struct stat *);
|
|
} glob_t;
|
|
|
|
-#define NAMLEN(_d) NLENGTH(_d)
|
|
-
|
|
#include <errno.h>
|
|
#ifndef __set_errno
|
|
#define __set_errno(val) errno = (val)
|
|
@@ -746,7 +745,7 @@ glob_in_dir(const char *pattern, const char *directory, int flags,
|
|
if (fnmatch(pattern, name, fnm_flags) == 0) {
|
|
struct globlink *new = (struct globlink *)
|
|
alloca(sizeof(struct globlink));
|
|
- len = NAMLEN(d);
|
|
+ len = strlen(d->d_name);
|
|
new->name = (char *) xmalloc(len + 1);
|
|
*((char *) mempcpy(new->name, name, len))
|
|
= '\0';
|
|
diff --git a/rpmio/rpmio.c b/rpmio/rpmio.c
|
|
index 82c3302..aa1357c 100644
|
|
--- a/rpmio/rpmio.c
|
|
+++ b/rpmio/rpmio.c
|
|
@@ -6,6 +6,7 @@
|
|
#include <stdarg.h>
|
|
#include <errno.h>
|
|
#include <ctype.h>
|
|
+#include <dirent.h>
|
|
#if defined(__linux__)
|
|
#include <sys/personality.h>
|
|
#endif
|
|
diff --git a/system.h b/system.h
|
|
index 8854d70..f0122cb 100644
|
|
--- a/system.h
|
|
+++ b/system.h
|
|
@@ -49,23 +49,6 @@ char * stpncpy(char * dest, const char * src, size_t n);
|
|
#include <sys/file.h>
|
|
#endif
|
|
|
|
-#ifdef HAVE_DIRENT_H
|
|
-# include <dirent.h>
|
|
-# define NLENGTH(direct) (strlen((direct)->d_name))
|
|
-#else /* not HAVE_DIRENT_H */
|
|
-# define dirent direct
|
|
-# define NLENGTH(direct) ((direct)->d_namlen)
|
|
-# ifdef HAVE_SYS_NDIR_H
|
|
-# include <sys/ndir.h>
|
|
-# endif /* HAVE_SYS_NDIR_H */
|
|
-# ifdef HAVE_SYS_DIR_H
|
|
-# include <sys/dir.h>
|
|
-# endif /* HAVE_SYS_DIR_H */
|
|
-# ifdef HAVE_NDIR_H
|
|
-# include <ndir.h>
|
|
-# endif /* HAVE_NDIR_H */
|
|
-#endif /* HAVE_DIRENT_H */
|
|
-
|
|
#if HAVE_LIMITS_H
|
|
#include <limits.h>
|
|
#endif
|
|
--
|
|
1.8.3.1
|
|
|