diff options
author | Karel Klic <kklic@redhat.com> | 2010-08-19 11:10:13 +0200 |
---|---|---|
committer | Karel Klic <kklic@redhat.com> | 2010-08-19 11:10:13 +0200 |
commit | 1c29b03301524f1e969df8ce1c753cd3dd6fd589 (patch) | |
tree | 20714983c76ae7f12340ec48b64c51acf97f6e14 /lib/utils/xfuncs.c | |
parent | 16d4ddcd274bf8e0579358b6f60bb93e67da5852 (diff) | |
download | abrt-1c29b03301524f1e969df8ce1c753cd3dd6fd589.tar.gz abrt-1c29b03301524f1e969df8ce1c753cd3dd6fd589.tar.xz abrt-1c29b03301524f1e969df8ce1c753cd3dd6fd589.zip |
include headers as needed
synchronize function ordering with the header file
Diffstat (limited to 'lib/utils/xfuncs.c')
-rw-r--r-- | lib/utils/xfuncs.c | 32 |
1 files changed, 19 insertions, 13 deletions
diff --git a/lib/utils/xfuncs.c b/lib/utils/xfuncs.c index bd6efec8..02ad9fd8 100644 --- a/lib/utils/xfuncs.c +++ b/lib/utils/xfuncs.c @@ -23,6 +23,12 @@ */ #include "xfuncs.h" +#include "logging.h" +#include "read_write.h" +#include <fcntl.h> +#include <pwd.h> +#include <stdio.h> +#include <stdlib.h> /* Turn on nonblocking I/O on a fd */ int ndelay_on(int fd) @@ -262,13 +268,6 @@ void xstat(const char *name, struct stat *stat_buf) perror_msg_and_die("can't stat '%s'", name); } -const char *get_home_dir(uid_t uid) -{ - struct passwd* pw = getpwuid(uid); - // TODO: handle errno - return pw ? pw->pw_dir : NULL; -} - // Die if we can't open a file and return a fd int xopen3(const char *pathname, int flags, int mode) { @@ -285,6 +284,12 @@ int xopen(const char *pathname, int flags) return xopen3(pathname, flags, 0666); } +void xunlink(const char *pathname) +{ + if (unlink(pathname)) + perror_msg_and_die("can't remove file '%s'", pathname); +} + #if 0 //UNUSED // Warn if we can't open a file and return a fd. int open3_or_warn(const char *pathname, int flags, int mode) @@ -303,12 +308,6 @@ int open_or_warn(const char *pathname, int flags) } #endif -void xunlink(const char *pathname) -{ - if (unlink(pathname)) - perror_msg_and_die("can't remove file '%s'", pathname); -} - /* Just testing dent->d_type == DT_REG is wrong: some filesystems * do not report the type, they report DT_UNKNOWN for every dirent * (and this is not a bug in filesystem, this is allowed by standards). @@ -389,3 +388,10 @@ void xsetregid(gid_t rgid, gid_t egid) if (setregid(rgid, egid) != 0) perror_msg_and_die("can't set %cid %lu", 'g', (long)rgid); } + +const char *get_home_dir(uid_t uid) +{ + struct passwd* pw = getpwuid(uid); + // TODO: handle errno + return pw ? pw->pw_dir : NULL; +} |