aboutsummaryrefslogtreecommitdiffstats
path: root/meta-networking/recipes-daemons/autofs/autofs/0001-Define-__SWORD_TYPE-if-undefined.patch
blob: f16ae5277e1f6cc7a3771bfe185fb21cfe1d149e (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
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(-)

--- 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,
 			     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
 
 	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(unsi
 	/*
 	 *  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 *ar
 	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);
--- 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
--- a/lib/log.c
+++ b/lib/log.c
@@ -38,7 +38,11 @@ static char *prepare_attempt_prefix(cons
 	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;