summaryrefslogtreecommitdiffstats
path: root/srUtils.c
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2007-07-18 15:16:15 +0000
committerRainer Gerhards <rgerhards@adiscon.com>2007-07-18 15:16:15 +0000
commit4a963e5f1fdac9c1d4d404fe75ea2ceaf93ae37d (patch)
tree6d0d0382436109f21844ab952507e8eed42b4ec6 /srUtils.c
parent48c0c81132fe0b4aadf46fd54fc5acd61bfbeffa (diff)
downloadrsyslog-4a963e5f1fdac9c1d4d404fe75ea2ceaf93ae37d.tar.gz
rsyslog-4a963e5f1fdac9c1d4d404fe75ea2ceaf93ae37d.tar.xz
rsyslog-4a963e5f1fdac9c1d4d404fe75ea2ceaf93ae37d.zip
code cleanup (removed compiler warnings
Diffstat (limited to 'srUtils.c')
-rwxr-xr-xsrUtils.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/srUtils.c b/srUtils.c
index 39219e10..ebba78cf 100755
--- a/srUtils.c
+++ b/srUtils.c
@@ -32,6 +32,8 @@
#include <string.h>
#include <unistd.h>
#include <errno.h>
+#include <sys/stat.h>
+#include <sys/types.h>
#include "rsyslog.h" /* THIS IS A MODIFICATION FOR RSYSLOG! 2004-11-18 rgerards */
#include "liblogging-stub.h" /* THIS IS A MODIFICATION FOR RSYSLOG! 2004-11-18 rgerards */
#define TRUE 1
@@ -96,7 +98,6 @@ uchar *srUtilStrDup(uchar *pOld, size_t len)
uchar *pNew;
assert(pOld != NULL);
- assert(len >= 0);
if((pNew = malloc(len + 1)) != NULL)
memcpy(pNew, pOld, len + 1);
@@ -120,9 +121,9 @@ int makeFileParentDirs(uchar *szFile, size_t lenFile, mode_t mode,
int bErr = 0;
assert(szFile != NULL);
- assert(len > 0);
+ assert(lenFile > 0);
- len = strlen(szFile) + 1; /* add one for '\0'-byte */
+ len = lenFile + 1; /* add one for '\0'-byte */
if((pszWork = malloc(sizeof(uchar) * len)) == NULL)
return -1;
memcpy(pszWork, szFile, len);
@@ -130,11 +131,11 @@ int makeFileParentDirs(uchar *szFile, size_t lenFile, mode_t mode,
if(*p == '/') {
/* temporarily terminate string, create dir and go on */
*p = '\0';
- if(access(pszWork, F_OK)) {
- if(mkdir(pszWork, mode) == 0) {
- if(uid != -1 || gid != -1) {
+ if(access((char*)pszWork, F_OK)) {
+ if(mkdir((char*)pszWork, mode) == 0) {
+ if(uid != (uid_t) -1 || gid != (gid_t) -1) {
/* we need to set owner/group */
- if(chown(pszWork, uid, gid) != 0)
+ if(chown((char*)pszWork, uid, gid) != 0)
if(bFailOnChown)
bErr = 1;
/* silently ignore if configured