aboutsummaryrefslogtreecommitdiffstats
path: root/meta-networking/recipes-daemons/autofs/autofs/0001-Define-__SWORD_TYPE-if-undefined.patch
blob: 117b1e58a9b4fb9b27172f046a914b2a820ddaa8 (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
120
121
122
123
124
From 9fe90ab1e333b2e2bed370ff13ba552eb54c3aaf Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Sat, 17 Jul 2021 09:56:28 -0700
Subject: [PATCH] Define __SWORD_TYPE if undefined

These fixes are inspired when building autofs on musl

Upstream-Status: Pending
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 daemon/automount.c | 20 ++++++++++++++------
 include/hash.h     |  5 +++++
 lib/log.c          |  6 +++++-
 3 files changed, 24 insertions(+), 7 deletions(-)

diff --git a/daemon/automount.c b/daemon/automount.c
index e476f6b..3a1514b 100644
--- a/daemon/automount.c
+++ b/daemon/automount.c
@@ -1,7 +1,7 @@
 /* ----------------------------------------------------------------------- *
  *
  *  automount.c - Linux automounter daemon
- *   
+ *
  *   Copyright 1997 Transmeta Corporation - All Rights Reserved
  *   Copyright 1999-2000 Jeremy Fitzhardinge <jeremy@goop.org>
  *   Copyright 2001-2005 Ian Kent <raven@themaw.net>
@@ -11,7 +11,7 @@
  *   the Free Software Foundation, Inc., 675 Mass Ave, Cambridge MA 02139,
  *   USA; either version 2 of the License, or (at your option) any later
  *   version.
- *   
+ *
  *   This program is distributed in the hope that it will be useful,
  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
@@ -40,6 +40,14 @@
 #include <systemd/sd-daemon.h>
 #endif
 
+#ifndef __SWORD_TYPE
+# if __WORDSIZE == 32  /* System word size */
+#  define __SWORD_TYPE int
+# else /* __WORDSIZE == 64 */
+#  define __SWORD_TYPE long int
+# endif
+#endif
+
 #include "automount.h"
 #if defined(LIBXML2_WORKAROUND) || defined(TIRPC_WORKAROUND)
 #include <dlfcn.h>
@@ -282,7 +290,7 @@ int rmdir_path(struct autofs_point *ap, const char *path, dev_t dev)
 			     dev, buf, st.st_dev);
 			return -1;
 		}
-			     
+
 		/*
 		 * Last element of path may be a symbolic link; all others
 		 * are directories (and the last directory element is
@@ -455,7 +463,7 @@ int count_mounts(struct autofs_point *ap, const char *path, dev_t dev)
 
 	counter.count = 0;
 	counter.dev = dev;
-	
+
 	if (walk_tree(path, counter_fn, 1, ap, &counter) == -1)
 		return -1;
 
@@ -811,7 +819,7 @@ static char *automount_path_to_fifo(unsigned logopt, const char *path)
 	/*
 	 *  An automount path can be made up of subdirectories.  So, to
 	 *  create the fifo name, we will just replace instances of '/' with
-	 *  '-'. 
+	 *  '-'.
 	 */
 	p = fifo_name + strlen(fifodir);
 	while (*p != '\0') {
@@ -1640,7 +1648,7 @@ static void return_start_status(void *arg)
 	sc->done = 1;
 
 	/*
-	 * Startup condition mutex must be locked during 
+	 * Startup condition mutex must be locked during
 	 * the startup process.
 	 */
 	status = pthread_cond_signal(&sc->cond);
diff --git a/include/hash.h b/include/hash.h
index 2447f29..6f0dee6 100644
--- a/include/hash.h
+++ b/include/hash.h
@@ -5,6 +5,11 @@
 
 #include <sys/types.h>
 #include <stdint.h>
+#include <linux/stddef.h>
+
+#ifndef __GLIBC__
+#include <sys/reg.h>
+#endif
 
 /*
  * The "GOLDEN_RATIO_PRIME" is used in ifs/btrfs/brtfs_inode.h and
diff --git a/lib/log.c b/lib/log.c
index 0cb47d7..39b1e3b 100644
--- a/lib/log.c
+++ b/lib/log.c
@@ -38,7 +38,11 @@ static char *prepare_attempt_prefix(const char *msg)
 	char buffer[ATTEMPT_ID_SIZE + 1];
 	char *prefixed_msg = NULL;
 
-	attempt_id = pthread_getspecific(key_thread_attempt_id);
+        if (key_thread_attempt_id) {
+                attempt_id = pthread_getspecific(key_thread_attempt_id);
+        } else {
+                attempt_id = 0;
+        }
 	if (attempt_id) {
 		int len = sizeof(buffer) + 1 + strlen(msg) + 1;
 
-- 
2.32.0