Move ctim_get and mtim_get to sudo_util.h
This commit is contained in:
@@ -52,6 +52,7 @@
|
||||
#include "fatal.h"
|
||||
#include "sudo_plugin.h"
|
||||
#include "sudo_debug.h"
|
||||
#include "sudo_util.h"
|
||||
|
||||
#define DEFAULT_TEXT_DOMAIN "sudo"
|
||||
#include "gettext.h"
|
||||
|
35
config.h.in
35
config.h.in
@@ -1112,41 +1112,6 @@
|
||||
code using `volatile' can become incorrect without. Disable with care. */
|
||||
#undef volatile
|
||||
|
||||
/*
|
||||
* Macros to convert ctime and mtime into timevals.
|
||||
*/
|
||||
#define timespec2timeval(_ts, _tv) do { \
|
||||
(_tv)->tv_sec = (_ts)->tv_sec; \
|
||||
(_tv)->tv_usec = (_ts)->tv_nsec / 1000; \
|
||||
} while (0)
|
||||
|
||||
#ifdef HAVE_ST_MTIM
|
||||
# ifdef HAVE_ST__TIM
|
||||
# define ctim_get(_x, _y) timespec2timeval(&(_x)->st_ctim.st__tim, (_y))
|
||||
# define mtim_get(_x, _y) timespec2timeval(&(_x)->st_mtim.st__tim, (_y))
|
||||
# else
|
||||
# define ctim_get(_x, _y) timespec2timeval(&(_x)->st_ctim, (_y))
|
||||
# define mtim_get(_x, _y) timespec2timeval(&(_x)->st_mtim, (_y))
|
||||
# endif
|
||||
#else
|
||||
# ifdef HAVE_ST_MTIMESPEC
|
||||
# define ctim_get(_x, _y) timespec2timeval(&(_x)->st_ctimespec, (_y))
|
||||
# define mtim_get(_x, _y) timespec2timeval(&(_x)->st_mtimespec, (_y))
|
||||
# else
|
||||
# define ctim_get(_x, _y) do { (_y)->tv_sec = (_x)->st_ctime; (_y)->tv_usec = 0; } while (0)
|
||||
# define mtim_get(_x, _y) do { (_y)->tv_sec = (_x)->st_mtime; (_y)->tv_usec = 0; } while (0)
|
||||
# endif /* HAVE_ST_MTIMESPEC */
|
||||
#endif /* HAVE_ST_MTIM */
|
||||
|
||||
#ifdef __GNUC__
|
||||
# define ignore_result(x) do { \
|
||||
__typeof__(x) y = (x); \
|
||||
(void)y; \
|
||||
} while(0)
|
||||
#else
|
||||
# define ignore_result(x) (void)(x)
|
||||
#endif
|
||||
|
||||
/* BSD compatibility on some SVR4 systems. */
|
||||
#ifdef __svr4__
|
||||
# define BSD_COMP
|
||||
|
@@ -103,6 +103,39 @@
|
||||
} while (0)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Macros to extract ctime and mtime as timevals.
|
||||
*/
|
||||
#ifdef HAVE_ST_MTIM
|
||||
# ifdef HAVE_ST__TIM
|
||||
# define ctim_get(_x, _y) TIMESPEC_TO_TIMEVAL((_y), &(_x)->st_ctim.st__tim)
|
||||
# define mtim_get(_x, _y) TIMESPEC_TO_TIMEVAL((_y), &(_x)->st_mtim.st__tim)
|
||||
# else
|
||||
# define ctim_get(_x, _y) TIMESPEC_TO_TIMEVAL((_y), &(_x)->st_ctim)
|
||||
# define mtim_get(_x, _y) TIMESPEC_TO_TIMEVAL((_y), &(_x)->st_mtim)
|
||||
# endif
|
||||
#else
|
||||
# ifdef HAVE_ST_MTIMESPEC
|
||||
# define ctim_get(_x, _y) TIMESPEC_TO_TIMEVAL((_y), &(_x)->st_ctimespec)
|
||||
# define mtim_get(_x, _y) TIMESPEC_TO_TIMEVAL((_y), &(_x)->st_mtimespec)
|
||||
# else
|
||||
# define ctim_get(_x, _y) do { (_y)->tv_sec = (_x)->st_ctime; (_y)->tv_usec = 0; } while (0)
|
||||
# define mtim_get(_x, _y) do { (_y)->tv_sec = (_x)->st_mtime; (_y)->tv_usec = 0; } while (0)
|
||||
# endif /* HAVE_ST_MTIMESPEC */
|
||||
#endif /* HAVE_ST_MTIM */
|
||||
|
||||
/*
|
||||
* Macros to quiet gcc's warn_unused_result attribute.
|
||||
*/
|
||||
#ifdef __GNUC__
|
||||
# define ignore_result(x) do { \
|
||||
__typeof__(x) y = (x); \
|
||||
(void)y; \
|
||||
} while(0)
|
||||
#else
|
||||
# define ignore_result(x) (void)(x)
|
||||
#endif
|
||||
|
||||
/* aix.c */
|
||||
void aix_prep_user(char *user, const char *tty);
|
||||
void aix_restoreauthdb(void);
|
||||
|
@@ -55,6 +55,7 @@
|
||||
|
||||
#include <pathnames.h>
|
||||
#include "sudo_plugin.h"
|
||||
#include "sudo_util.h"
|
||||
#include "missing.h"
|
||||
|
||||
/*
|
||||
|
Reference in New Issue
Block a user