summaryrefslogtreecommitdiffstats
path: root/src/libs/zbxsysinfo/common
diff options
context:
space:
mode:
authorsasha <sasha@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2008-05-08 10:07:11 +0000
committersasha <sasha@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2008-05-08 10:07:11 +0000
commit88200af1f657d31aa8ac69e35a12ff5a1bae6e70 (patch)
tree990e2d9b09de829df4ffb2368fbedb3a5427115f /src/libs/zbxsysinfo/common
parent2a264d02b20ebdf8fd4eb1b144ee1d446c8da394 (diff)
downloadzabbix-88200af1f657d31aa8ac69e35a12ff5a1bae6e70.tar.gz
zabbix-88200af1f657d31aa8ac69e35a12ff5a1bae6e70.tar.xz
zabbix-88200af1f657d31aa8ac69e35a12ff5a1bae6e70.zip
- [DEV-168] added more supported items in FreeBSD, NetBSD and OpenBSD
git-svn-id: svn://svn.zabbix.com/trunk@5685 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'src/libs/zbxsysinfo/common')
-rw-r--r--src/libs/zbxsysinfo/common/file.c23
1 files changed, 7 insertions, 16 deletions
diff --git a/src/libs/zbxsysinfo/common/file.c b/src/libs/zbxsysinfo/common/file.c
index 657ad9ad..b7ad3628 100644
--- a/src/libs/zbxsysinfo/common/file.c
+++ b/src/libs/zbxsysinfo/common/file.c
@@ -106,33 +106,24 @@ int VFS_FILE_TIME(const char *cmd, const char *param, unsigned flags, AGENT_RESU
int VFS_FILE_EXISTS(const char *cmd, const char *param, unsigned flags, AGENT_RESULT *result)
{
struct stat buf;
- char filename[MAX_STRING_LEN];
+ char filename[MAX_STRING_LEN];
assert(result);
init_result(result);
- if(num_param(param) > 1)
- {
+ if (num_param(param) > 1)
return SYSINFO_RET_FAIL;
- }
- if(get_param(param, 1, filename, MAX_STRING_LEN) != 0)
- {
+ if (0 != get_param(param, 1, filename, sizeof(filename)))
return SYSINFO_RET_FAIL;
- }
SET_UI64_RESULT(result, 0);
- /* File exists */
- if(stat(filename,&buf) == 0)
- {
- /* Regular file */
- if(S_ISREG(buf.st_mode))
- {
+
+ if (0 == stat(filename, &buf)) /* File exists */
+ if (S_ISREG(buf.st_mode)) /* Regular file */
SET_UI64_RESULT(result, 1);
- }
- }
- /* File does not exist or any other error */
+
return SYSINFO_RET_OK;
}