blob: f16ae5277e1f6cc7a3771bfe185fb21cfe1d149e [file] [log] [blame]
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;