-
Patch request
-
Resolution: Fixed
-
Major
-
6.0.0beta1
-
HP-UX hpux11i3 B.11.31 U ia64 3932273393 unlimited-user license
-
Sprint 84 (Jan 2022)
-
0.5
Steps to reproduce:
- Get vfs.file.get metric from HP-UX agent
Result:
Agent returns ZBX_NOTSUPPORTED: Cannot obtain file or directory name.
Expected:
Agent returns JSON strings.
About the patch:
In Linux realpath(), the resulting pathname is stored to up to a maximum of PATH_MAX bytes automatically when second argument is NULL. But in HP-UX realpath(), developer should prepare output buffer then give the pointer to second argument.
For example:
#include <stdio.h> #include <stdlib.h> int main(void) { char *ptr; if (NULL == (ptr = realpath("/etc/passwd", NULL))) printf("FAIL\n"); else printf("OK: %s\n", ptr); }
Output is "OK: /etc/passwd" in Linux but "FAIL" in HP-UX.
This code returns "OK: /etc/passwd" in HP-UX and Linux.
#include <stdio.h> #include <stdlib.h> #include <limits.h> int main(void) { char *ptr; char resolved_name[PATH_MAX + 1]; if (NULL == (ptr = realpath("/etc/passwd", resolved_name))) printf("FAIL\n"); else printf("OK: %s\n", ptr); }
I defined output buffer array when only HP-UX in the patch because vfs.get.file key works file in Linux and Solaris.