Radish alpha
H
rad:z3QDZAW2FAfuLvihrhiyDC9fAD8G9
HardenedBSD Package Manager
Radicle
Git
compat: all supported OS have a valid unlinkat(3)
Baptiste Daroussin committed 3 months ago
commit b47fb7409cf7e57dded92092cfed7fb1cc44486b
parent 3009baa
3 files changed +5 -32
modified auto.def
@@ -180,7 +180,7 @@ cc-check-includes stdint.h inttypes.h
# check for pkg itself
cc-check-functions arc4random arc4random_stir basename_r chflagsat \
	closefrom dirfd eaccess fopencookie fstatfs funopen getprogname strnstr \
-
	strtofflags strtonum sysconf utimensat __res_setservers unlinkat \
+
	strtofflags strtonum sysconf utimensat __res_setservers \
	faccessat fstatat openat readlinkat fflagstostr reallocarray strchrnul \
	copy_file_range

modified compat/bsd_compat.h
@@ -1,7 +1,7 @@
/*-
 * Copyright (c) 2014 Landon Fuller <landon@landonf.org>
 * All rights reserved.
-
 * 
+
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
@@ -11,7 +11,7 @@
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
-
 * 
+
 *
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
@@ -128,13 +128,6 @@ int openat(int fd, const char *path, int flags, ...);
ssize_t readlinkat(int fd, const char *restrict path, char *restrict buf, size_t bufsize);
#endif

-
#if !HAVE_UNLINKAT
-
# ifndef AT_REMOVEDIR
-
#  define AT_REMOVEDIR	0x800
-
# endif
-
int unlinkat(int fd, const char *path, int flag);
-
#endif
-

#if !HAVE_STRTONUM
long long strtonum(const char *, long long, long long, const char **);
#endif
modified compat/file_at.c
@@ -1,7 +1,7 @@
/*
 * Copyright (c) 2014 Landon Fuller <landon@landonf.org>
 * All rights reserved.
-
 * 
+
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
@@ -11,7 +11,7 @@
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
-
 * 
+
 *
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
@@ -176,23 +176,3 @@ openat(int fd, const char *path, int flags, ...)
	return ret;
}
#endif
-

-
#if !HAVE_UNLINKAT
-
int
-
unlinkat(int fd, const char *path, int flag)
-
{
-
	int ret;
-

-
	if ((ret = file_chdir_lock(fd) != 0))
-
		return ret;
-

-
	if (flag & AT_REMOVEDIR) {
-
		ret = rmdir(path);
-
	} else {
-
		ret = unlink(path);
-
	}
-

-
	file_chdir_unlock(fd);
-
	return ret;
-
}
-
#endif