aboutsummaryrefslogtreecommitdiffstats
path: root/meta-oe/recipes-support/inotify-tools/inotify-tools/0003-replace-stat64-lstat64-with-stat-lstat.patch
blob: c0784ecc7385ab94ca2d3e37a65d554c16e50966 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
From c6093ad63b92f5d25e6826d1c49dc7cee86d3747 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Tue, 20 Dec 2022 10:48:10 -0800
Subject: [PATCH] replace stat64/lstat64 with stat/lstat

lfs64 functions are not needed when off_t is 64-bit
Additionally this fixes build with musl which does not
export these functions without defining _LARGEFILE64_SOURCE

Upstream-Status: Submitted [https://github.com/inotify-tools/inotify-tools/pull/174]
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 libinotifytools/src/inotifytools.c               | 8 ++++----
 libinotifytools/src/inotifytools/inotify-nosys.h | 5 -----
 libinotifytools/src/inotifytools/inotifytools.h  | 5 -----
 src/common.c                                     | 4 ++--
 src/common.h                                     | 6 +-----
 5 files changed, 7 insertions(+), 21 deletions(-)

diff --git a/libinotifytools/src/inotifytools.c b/libinotifytools/src/inotifytools.c
index 50f6135..3e17ac6 100644
--- a/libinotifytools/src/inotifytools.c
+++ b/libinotifytools/src/inotifytools.c
@@ -1750,14 +1750,14 @@ int inotifytools_watch_recursively_with_exclude(char const* path,
 
 	static struct dirent * ent;
 	char * next_file;
-	static struct stat64 my_stat;
+	static struct stat my_stat;
 	ent = readdir( dir );
 	// Watch each directory within this directory
 	while ( ent ) {
 		if ( (0 != strcmp( ent->d_name, "." )) &&
 		     (0 != strcmp( ent->d_name, ".." )) ) {
 			nasprintf(&next_file,"%s%s", my_path, ent->d_name);
-			if ( -1 == lstat64( next_file, &my_stat ) ) {
+			if ( -1 == lstat( next_file, &my_stat ) ) {
 				error = errno;
 				free( next_file );
 				if ( errno != EACCES ) {
@@ -1840,9 +1840,9 @@ int inotifytools_error() {
  * @internal
  */
 static int isdir( char const * path ) {
-	static struct stat64 my_stat;
+	static struct stat my_stat;
 
-	if ( -1 == lstat64( path, &my_stat ) ) {
+	if ( -1 == lstat( path, &my_stat ) ) {
 		if (errno == ENOENT) return 0;
 		fprintf(stderr, "Stat failed on %s: %s\n", path, strerror(errno));
 		return 0;
diff --git a/libinotifytools/src/inotifytools/inotify-nosys.h b/libinotifytools/src/inotifytools/inotify-nosys.h
index 01aa45e..97166d4 100644
--- a/libinotifytools/src/inotifytools/inotify-nosys.h
+++ b/libinotifytools/src/inotifytools/inotify-nosys.h
@@ -13,11 +13,6 @@
 #include <sys/syscall.h>
 #include <unistd.h>
 
-#ifdef __FreeBSD__
-#define stat64 stat
-#define lstat64 lstat
-#endif
-
 /*
  * struct inotify_event - structure read from the inotify device for each event
  *
diff --git a/libinotifytools/src/inotifytools/inotifytools.h b/libinotifytools/src/inotifytools/inotifytools.h
index 49936ae..2ec4358 100644
--- a/libinotifytools/src/inotifytools/inotifytools.h
+++ b/libinotifytools/src/inotifytools/inotifytools.h
@@ -1,11 +1,6 @@
 #ifndef _inotifytools_H
 #define _inotifytools_H
 
-#ifdef __FreeBSD__
-#define stat64 stat
-#define lstat64 lstat
-#endif
-
 #ifdef __cplusplus
 extern "C"
 {
diff --git a/src/common.c b/src/common.c
index 5a6fda1..885286e 100644
--- a/src/common.c
+++ b/src/common.c
@@ -45,9 +45,9 @@ void print_event_descriptions() {
 }
 
 int isdir(char const *path) {
-    static struct stat64 my_stat;
+    static struct stat my_stat;
 
-    if (-1 == lstat64(path, &my_stat)) {
+    if (-1 == lstat(path, &my_stat)) {
         if (errno == ENOENT)
             return 0;
         fprintf(stderr, "Stat failed on %s: %s\n", path, strerror(errno));
diff --git a/src/common.h b/src/common.h
index 12d3dde..7f1e34a 100644
--- a/src/common.h
+++ b/src/common.h
@@ -1,13 +1,9 @@
 #ifndef COMMON_H
 #define COMMON_H
 
-#ifdef __FreeBSD__
-#define stat64 stat
-#define lstat64 lstat
-#ifdef ENABLE_FANOTIFY
+#if defined(__FreeBSD__) && defined(ENABLE_FANOTIFY)
 #error "FreeBSD does not support fanotify"
 #endif
-#endif
 
 #include <stdbool.h>