diff options
| author | beatrice <beatrice@dangofactory.net> | 2026-11-22 19:19:03 +0900 |
|---|---|---|
| committer | beatrice <beatrice@dangofactory.net> | 2026-11-22 19:19:03 +0900 |
| commit | bd4611555e18fca7c66afaef0f094e15038b0459 (patch) | |
| tree | 1b1a9109567b61ac259ead146f4bef21a0f886df /src/util/wrap_stat.c | |
| parent | 2324a9e97a727bf95690c9fb8fdca0f52301940e (diff) | |
| download | postfix-master.tar.gz postfix-master.zip | |
Release tarball postfix-3.11.7.tar.gz (dist-generated files / local differences from tag)HEADlocal/postfixmaster
Diffstat (limited to 'src/util/wrap_stat.c')
| -rw-r--r-- | src/util/wrap_stat.c | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/src/util/wrap_stat.c b/src/util/wrap_stat.c new file mode 100644 index 000000000..321913a05 --- /dev/null +++ b/src/util/wrap_stat.c @@ -0,0 +1,59 @@ +/*++ +/* NAME +/* wrap_stat 3 +/* SUMMARY +/* mockable stat/lstat wrappers +/* SYNOPSIS +/* #include <wrap_stat.h> +/* +/* int wrap_stat( +/* const char *path, +/* struct stat *st) +/* +/* int wrap_lstat( +/* const char *path, +/* struct stat *st) +/* DESCRIPTION +/* This module is a NOOP when the NO_MOCK_WRAPPERS macro is +/* defined. +/* +/* By default this module redirects stat() and lstat() calls to +/* the above listed wrapper functions that may be overridden with +/* mocks. This arrangement prevents mock stat() or lstat() functions +/* from interfering with stat() or lstat() calls made by system +/* libraries or by third-party libraries. +/* LICENSE +/* .ad +/* .fi +/* The Secure Mailer license must be distributed with this software. +/* AUTHOR(S) +/* Wietse Venema +/* porcupine.org +/*--*/ + + /* + * System library. + */ +#include <sys_defs.h> +#include <sys/stat.h> + + /* + * Utility library. + */ +#include <wrap_stat.h> + +/* wrap_stat - mockable wrapper */ + +int wrap_stat(const char *path, struct stat *st) +{ +#undef stat + return (stat (path, st)); +} + +/* wrap_lstat - mockable wrapper */ + +int wrap_lstat(const char *path, struct stat *st) +{ +#undef lstat + return (lstat(path, st)); +} |
