Use MAC_OS_X_VERSION_MIN_REQUIRED. From Sevan Janiyan, GitHub issue 4550.

This commit is contained in:
Nicholas Marriott
2025-07-13 07:26:35 +01:00
parent 7e43953937
commit 9f1fac9142
2 changed files with 9 additions and 8 deletions

View File

@ -49,12 +49,12 @@
#include <mach/mach.h>
#include <Availability.h>
#include <AvailabilityMacros.h>
#include <unistd.h>
void daemon_darwin(void);
#ifdef __MAC_10_10
#if MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
extern kern_return_t bootstrap_look_up_per_user(mach_port_t, const char *,
uid_t, mach_port_t *);

View File

@ -16,11 +16,14 @@
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include <sys/cdefs.h>
#include <sys/types.h>
#include <sys/sysctl.h>
#include <Availability.h>
#include <AvailabilityMacros.h>
#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1050
#include <libproc.h>
#endif
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
@ -31,14 +34,10 @@ char *osdep_get_name(int, char *);
char *osdep_get_cwd(int);
struct event_base *osdep_event_init(void);
#ifndef __unused
#define __unused __attribute__ ((__unused__))
#endif
char *
osdep_get_name(int fd, __unused char *tty)
{
#ifdef __MAC_10_7
#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
struct proc_bsdshortinfo bsdinfo;
pid_t pgrp;
int ret;
@ -72,6 +71,7 @@ osdep_get_name(int fd, __unused char *tty)
char *
osdep_get_cwd(int fd)
{
#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1050
static char wd[PATH_MAX];
struct proc_vnodepathinfo pathinfo;
pid_t pgrp;
@ -86,6 +86,7 @@ osdep_get_cwd(int fd)
strlcpy(wd, pathinfo.pvi_cdir.vip_path, sizeof wd);
return (wd);
}
#endif
return (NULL);
}