summaryrefslogtreecommitdiffstats
path: root/src/util/check_and_open.c
diff options
context:
space:
mode:
authorNikolai Kondrashov <Nikolai.Kondrashov@redhat.com>2014-02-12 10:12:04 -0500
committerJakub Hrozek <jhrozek@redhat.com>2014-02-12 22:30:55 +0100
commita3c8390d19593b1e5277d95bfb4ab206d4785150 (patch)
tree2eb4e5432f4f79a75589c03b1513b656879ebf9c /src/util/check_and_open.c
parentcc026fd9ba386f2197e3217940d597dcad1a26fe (diff)
downloadsssd-a3c8390d19593b1e5277d95bfb4ab206d4785150.tar.gz
sssd-a3c8390d19593b1e5277d95bfb4ab206d4785150.tar.xz
sssd-a3c8390d19593b1e5277d95bfb4ab206d4785150.zip
Make DEBUG macro invocations variadic
Use a script to update DEBUG macro invocations to use it as a variadic macro, supplying format string and its arguments directly, instead of wrapping them in parens. This script was used to update the code: grep -rwl --include '*.[hc]' DEBUG . | while read f; do mv "$f"{,.orig} perl -e \ 'use strict; use File::Slurp; my $text=read_file(\*STDIN); $text=~s#(\bDEBUG\s*\([^(]+)\((.*?)\)\s*\)\s*;#$1$2);#gs; print $text;' < "$f.orig" > "$f" rm "$f.orig" done Reviewed-by: Jakub Hrozek <jhrozek@redhat.com> Reviewed-by: Stephen Gallagher <sgallagh@redhat.com> Reviewed-by: Simo Sorce <simo@redhat.com>
Diffstat (limited to 'src/util/check_and_open.c')
-rw-r--r--src/util/check_and_open.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/util/check_and_open.c b/src/util/check_and_open.c
index c62619171..50eee6b2c 100644
--- a/src/util/check_and_open.c
+++ b/src/util/check_and_open.c
@@ -50,8 +50,8 @@ errno_t check_file(const char *filename, const int uid, const int gid,
ret = follow_symlink ? stat(filename, stat_buf) : \
lstat(filename, stat_buf);
if (ret == -1) {
- DEBUG(SSSDBG_TRACE_FUNC, ("lstat for [%s] failed: [%d][%s].\n", filename, errno,
- strerror(errno)));
+ DEBUG(SSSDBG_TRACE_FUNC, "lstat for [%s] failed: [%d][%s].\n", filename, errno,
+ strerror(errno));
return errno;
}
@@ -74,8 +74,8 @@ errno_t check_fd(int fd, const int uid, const int gid,
ret = fstat(fd, stat_buf);
if (ret == -1) {
- DEBUG(1, ("fstat for [%d] failed: [%d][%s].\n", fd, errno,
- strerror(errno)));
+ DEBUG(1, "fstat for [%d] failed: [%d][%s].\n", fd, errno,
+ strerror(errno));
return errno;
}
@@ -114,28 +114,28 @@ static errno_t perform_checks(struct stat *stat_buf,
type_check = S_ISSOCK(stat_buf->st_mode);
break;
default:
- DEBUG(1, ("Unsupported file type.\n"));
+ DEBUG(1, "Unsupported file type.\n");
return EINVAL;
}
if (!type_check) {
- DEBUG(1, ("File is not the right type.\n"));
+ DEBUG(1, "File is not the right type.\n");
return EINVAL;
}
if (mode >= 0 && (stat_buf->st_mode & ~S_IFMT) != mode) {
- DEBUG(1, ("File has the wrong mode [%.7o], expected [%.7o].\n",
- (stat_buf->st_mode & ~S_IFMT), mode));
+ DEBUG(1, "File has the wrong mode [%.7o], expected [%.7o].\n",
+ (stat_buf->st_mode & ~S_IFMT), mode);
return EINVAL;
}
if (uid >= 0 && stat_buf->st_uid != uid) {
- DEBUG(1, ("File must be owned by uid [%d].\n", uid));
+ DEBUG(1, "File must be owned by uid [%d].\n", uid);
return EINVAL;
}
if (gid >= 0 && stat_buf->st_gid != gid) {
- DEBUG(1, ("File must be owned by gid [%d].\n", gid));
+ DEBUG(1, "File must be owned by gid [%d].\n", gid);
return EINVAL;
}
@@ -151,8 +151,8 @@ errno_t check_and_open_readonly(const char *filename, int *fd, const uid_t uid,
*fd = open(filename, O_RDONLY);
if (*fd == -1) {
- DEBUG(1, ("open [%s] failed: [%d][%s].\n", filename, errno,
- strerror(errno)));
+ DEBUG(1, "open [%s] failed: [%d][%s].\n", filename, errno,
+ strerror(errno));
return errno;
}
@@ -160,7 +160,7 @@ errno_t check_and_open_readonly(const char *filename, int *fd, const uid_t uid,
if (ret != EOK) {
close(*fd);
*fd = -1;
- DEBUG(1, ("check_fd failed.\n"));
+ DEBUG(1, "check_fd failed.\n");
return ret;
}