tst_safe_file_ops.h revision bbdb9f78378c7e038f463efa39d2470e1c51ad54
169c2ab0bc5c448c0e2c33510b710b22b19907f51Cyril Hrubis/* 269c2ab0bc5c448c0e2c33510b710b22b19907f51Cyril Hrubis * Copyright (C) 2012 Cyril Hrubis chrubis@suse.cz 369c2ab0bc5c448c0e2c33510b710b22b19907f51Cyril Hrubis * 469c2ab0bc5c448c0e2c33510b710b22b19907f51Cyril Hrubis * This program is free software; you can redistribute it and/or modify it 569c2ab0bc5c448c0e2c33510b710b22b19907f51Cyril Hrubis * under the terms of version 2 of the GNU General Public License as 669c2ab0bc5c448c0e2c33510b710b22b19907f51Cyril Hrubis * published by the Free Software Foundation. 769c2ab0bc5c448c0e2c33510b710b22b19907f51Cyril Hrubis * 869c2ab0bc5c448c0e2c33510b710b22b19907f51Cyril Hrubis * This program is distributed in the hope that it would be useful, but 969c2ab0bc5c448c0e2c33510b710b22b19907f51Cyril Hrubis * WITHOUT ANY WARRANTY; without even the implied warranty of 1069c2ab0bc5c448c0e2c33510b710b22b19907f51Cyril Hrubis * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 1169c2ab0bc5c448c0e2c33510b710b22b19907f51Cyril Hrubis * 1269c2ab0bc5c448c0e2c33510b710b22b19907f51Cyril Hrubis * Further, this software is distributed without any warranty that it is 1369c2ab0bc5c448c0e2c33510b710b22b19907f51Cyril Hrubis * free of the rightful claim of any third person regarding infringement 1469c2ab0bc5c448c0e2c33510b710b22b19907f51Cyril Hrubis * or the like. Any license provided herein, whether implied or 1569c2ab0bc5c448c0e2c33510b710b22b19907f51Cyril Hrubis * otherwise, applies only to this software file. Patent licenses, if 1669c2ab0bc5c448c0e2c33510b710b22b19907f51Cyril Hrubis * any, provided herein do not apply to combinations of this program with 1769c2ab0bc5c448c0e2c33510b710b22b19907f51Cyril Hrubis * other software, or any other product whatsoever. 1869c2ab0bc5c448c0e2c33510b710b22b19907f51Cyril Hrubis * 1969c2ab0bc5c448c0e2c33510b710b22b19907f51Cyril Hrubis * You should have received a copy of the GNU General Public License along 2069c2ab0bc5c448c0e2c33510b710b22b19907f51Cyril Hrubis * with this program; if not, write the Free Software Foundation, Inc., 2169c2ab0bc5c448c0e2c33510b710b22b19907f51Cyril Hrubis * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 2269c2ab0bc5c448c0e2c33510b710b22b19907f51Cyril Hrubis */ 2369c2ab0bc5c448c0e2c33510b710b22b19907f51Cyril Hrubis 24bbdb9f78378c7e038f463efa39d2470e1c51ad54Cyril Hrubis#ifndef TST_SAFE_FILE_OPS 25bbdb9f78378c7e038f463efa39d2470e1c51ad54Cyril Hrubis#define TST_SAFE_FILE_OPS 2669c2ab0bc5c448c0e2c33510b710b22b19907f51Cyril Hrubis 27bbdb9f78378c7e038f463efa39d2470e1c51ad54Cyril Hrubis#include "safe_file_ops_fn.h" 2869c2ab0bc5c448c0e2c33510b710b22b19907f51Cyril Hrubis 29bbdb9f78378c7e038f463efa39d2470e1c51ad54Cyril Hrubis#define SAFE_FILE_SCANF(path, fmt, ...) \ 30bbdb9f78378c7e038f463efa39d2470e1c51ad54Cyril Hrubis safe_file_scanf(__FILE__, __LINE__, NULL, \ 31bbdb9f78378c7e038f463efa39d2470e1c51ad54Cyril Hrubis (path), (fmt), ## __VA_ARGS__) 3269c2ab0bc5c448c0e2c33510b710b22b19907f51Cyril Hrubis 33bbdb9f78378c7e038f463efa39d2470e1c51ad54Cyril Hrubis#define SAFE_FILE_PRINTF(path, fmt, ...) \ 34bbdb9f78378c7e038f463efa39d2470e1c51ad54Cyril Hrubis safe_file_printf(__FILE__, __LINE__, NULL, \ 35bbdb9f78378c7e038f463efa39d2470e1c51ad54Cyril Hrubis (path), (fmt), ## __VA_ARGS__) 3669c2ab0bc5c448c0e2c33510b710b22b19907f51Cyril Hrubis 37bbdb9f78378c7e038f463efa39d2470e1c51ad54Cyril Hrubis#define SAFE_CP(src, dst) \ 38bbdb9f78378c7e038f463efa39d2470e1c51ad54Cyril Hrubis safe_cp(__FILE__, __LINE__, NULL, (src), (dst)) 3969c2ab0bc5c448c0e2c33510b710b22b19907f51Cyril Hrubis 40bbdb9f78378c7e038f463efa39d2470e1c51ad54Cyril Hrubis#define SAFE_TOUCH(pathname, mode, times) \ 41bbdb9f78378c7e038f463efa39d2470e1c51ad54Cyril Hrubis safe_touch(__FILE__, __LINE__, NULL, \ 42bbdb9f78378c7e038f463efa39d2470e1c51ad54Cyril Hrubis (pathname), (mode), (times)) 4369c2ab0bc5c448c0e2c33510b710b22b19907f51Cyril Hrubis 44bbdb9f78378c7e038f463efa39d2470e1c51ad54Cyril Hrubis#endif /* TST_SAFE_FILE_OPS */ 45