Merge pull request #52 from giuseppe/fix-musl-build

Fix musl build
This commit is contained in:
Daniel J Walsh 2019-03-07 09:56:31 -05:00 committed by GitHub
commit 536abddd91
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 44 additions and 2 deletions

View File

@ -32,7 +32,7 @@ PKG_CHECK_MODULES([FUSE], [fuse3 >= 3.2.1], [AC_DEFINE([HAVE_FUSE], 1, [Define i
AC_FUNC_ERROR_AT_LINE
AC_FUNC_MALLOC
AC_CHECK_FUNCS([memset strdup])
AC_CHECK_FUNCS([open_by_handle_at error memset strdup])
AC_CONFIG_FILES([Makefile lib/Makefile])
AC_OUTPUT

44
main.c
View File

@ -36,7 +36,23 @@
#include <assert.h>
#include <errno.h>
#include <err.h>
#include <error.h>
#ifdef HAVE_ERROR_H
# include <error.h>
#else
# define error(status, errno, fmt, ...) do { \
if (errno == 0) \
fprintf (stderr, "crun: " fmt "\n", ##__VA_ARGS__); \
else \
{ \
fprintf (stderr, "crun: " fmt, ##__VA_ARGS__); \
fprintf (stderr, ": %s\n", strerror (errno)); \
} \
if (status) \
exit (status); \
} while(0)
#endif
#include <inttypes.h>
#include <fcntl.h>
#include <hash.h>
@ -57,6 +73,32 @@
#include <utils.h>
#ifndef TEMP_FAILURE_RETRY
#define TEMP_FAILURE_RETRY(expression) \
(__extension__ \
({ long int __result; \
do __result = (long int) (expression); \
while (__result == -1L && errno == EINTR); \
__result; }))
#endif
#ifndef HAVE_OPEN_BY_HANDLE_AT
struct file_handle
{
unsigned int handle_bytes; /* Size of f_handle [in, out] */
int handle_type; /* Handle type [out] */
unsigned char f_handle[0]; /* File identifier (sized by
caller) [out] */
};
int
open_by_handle_at (int mount_fd, struct file_handle *handle, int flags)
{
return syscall (SYS_open_by_handle_at, mount_fd, handle, flags);
}
#endif
#ifndef RENAME_EXCHANGE
# define RENAME_EXCHANGE (1 << 1)
# define RENAME_NOREPLACE (1 << 2)