Skip to content

Commit

Permalink
Move utimensat() replacement to use AC_REPLACE_FUNCS() framework
Browse files Browse the repository at this point in the history
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
  • Loading branch information
troglobit committed May 30, 2017
1 parent ab8dfeb commit d832114
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ AC_TYPE_UINT32_T

# Checks for library functions.
AC_FUNC_FORK
AC_CHECK_FUNCS([atexit dup2 memset select socket strchr strerror strrchr asprintf utimensat])
AC_CHECK_FUNCS([atexit dup2 memset select socket strchr strerror strrchr asprintf])

# Check for usually missing API's
AC_REPLACE_FUNCS([strlcpy])
AC_REPLACE_FUNCS([strlcpy utimensat])
AC_CONFIG_LIBOBJ_DIR([lib])

# Check for sun_len in struct sockaddr_un
Expand Down
2 changes: 0 additions & 2 deletions src/utimensat.c → lib/utimensat.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

#include "config.h"

#ifndef HAVE_UTIMENSAT
#include <errno.h>
#ifdef HAVE_FCNTL_H
#include <fcntl.h>
Expand All @@ -46,7 +45,6 @@ int utimensat(int dirfd, const char *pathname, const struct timespec ts[2], int

return ret;
}
#endif /* HAVE_UTIMENSAT */

/**
* Local Variables:
Expand Down
2 changes: 1 addition & 1 deletion src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ AUTOMAKE_OPTIONS = subdir-objects
sbin_PROGRAMS = smcrouted
smcrouted_SOURCES = smcrouted.c mroute.c mroute.h ifvc.c ifvc.h mcgroup.c mcgroup.h \
script.c script.h util.h log.c log.h pidfile.c socket.c socket.h \
timer.c timer.h utimensat.c queue.h
timer.c timer.h queue.h
smcrouted_CFLAGS = -W -Wall -Wextra -Wno-deprecated-declarations
smcrouted_CPPFLAGS = -D_ATFILE_SOURCE -D_INCOMPLETE_XOPEN_C063
smcrouted_CPPFLAGS += -DSYSCONFDIR=\"@sysconfdir@\" -DLOCALSTATEDIR=\"@localstatedir@\"
Expand Down
6 changes: 4 additions & 2 deletions src/util.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
/* Utilitity functions */
/* Utilitity and replacement functions */
#ifndef SMCROUTE_UTIL_H_
#define SMCROUTE_UTIL_H_

#include "config.h"
#include <string.h>
#include "mroute.h"

Expand All @@ -18,8 +19,9 @@
#endif

int pidfile(const char *basename, uid_t uid, gid_t gid);
#ifndef HAVE_UTIMENSAT
int utimensat(int dirfd, const char *pathname, const struct timespec ts[2], int flags);

#endif
#ifndef HAVE_STRLCPY
size_t strlcpy(char *dst, const char *src, size_t len);
#endif
Expand Down

0 comments on commit d832114

Please sign in to comment.