From: Jeremy Allison Date: Tue, 20 Aug 2019 23:28:18 +0000 (-0700) Subject: s3: smbd: Add sys_mknodat() wrapper call. X-Git-Tag: tevent-0.10.1~215 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e4c4af64fa7fde3ff116390182628235a2fb7185;p=thirdparty%2Fsamba.git s3: smbd: Add sys_mknodat() wrapper call. Signed-off-by: Jeremy Allison Reviewed-by: Ralph Böhme --- diff --git a/source3/include/proto.h b/source3/include/proto.h index e3ed2b8e4cb..17ea54fc4fe 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -234,6 +234,7 @@ int sys_fallocate(int fd, uint32_t mode, off_t offset, off_t len); void kernel_flock(int fd, uint32_t share_mode, uint32_t access_mask); DIR *sys_fdopendir(int fd); int sys_mknod(const char *path, mode_t mode, SMB_DEV_T dev); +int sys_mknodat(int dirfd, const char *path, mode_t mode, SMB_DEV_T dev); char *sys_getwd(void); void set_effective_capability(enum smbd_capability capability); void drop_effective_capability(enum smbd_capability capability); diff --git a/source3/lib/system.c b/source3/lib/system.c index a67388e436a..251c02bb1ee 100644 --- a/source3/lib/system.c +++ b/source3/lib/system.c @@ -590,6 +590,21 @@ int sys_mknod(const char *path, mode_t mode, SMB_DEV_T dev) #endif } +/******************************************************************* + A mknodat() wrapper. +********************************************************************/ + +int sys_mknodat(int dirfd, const char *path, mode_t mode, SMB_DEV_T dev) +{ +#if defined(HAVE_MKNODAT) + return mknodat(dirfd, path, mode, dev); +#else + /* No mknod system call. */ + errno = ENOSYS; + return -1; +#endif +} + /******************************************************************* System wrapper for getwd. Always returns MALLOC'ed memory, or NULL on error (malloc fail usually). diff --git a/source3/wscript b/source3/wscript index ae3b03825a2..3118abd738b 100644 --- a/source3/wscript +++ b/source3/wscript @@ -103,7 +103,7 @@ def configure(conf): conf.CHECK_HEADERS('netdb.h') conf.CHECK_HEADERS('linux/falloc.h linux/ioctl.h') - conf.CHECK_FUNCS('getcwd fchown chmod fchmod mknod') + conf.CHECK_FUNCS('getcwd fchown chmod fchmod mknod mknodat') conf.CHECK_FUNCS('strtol strchr strupr chflags') conf.CHECK_FUNCS('getrlimit fsync fdatasync setpgid') conf.CHECK_FUNCS('setsid glob strpbrk crypt16 getauthuid')