Uploaded image for project: 'ZABBIX BUGS AND ISSUES'
  1. ZABBIX BUGS AND ISSUES
  2. ZBX-20417

Fix vfs.file.get error in HP-UX

XMLWordPrintable

    • Icon: Patch request Patch request
    • Resolution: Fixed
    • Icon: Major Major
    • 6.0.0beta3, 6.0 (plan)
    • 6.0.0beta1
    • Agent (G)
    • HP-UX hpux11i3 B.11.31 U ia64 3932273393 unlimited-user license
    • Team C
    • Sprint 84 (Jan 2022)
    • 0.5

      Steps to reproduce:

      1. 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.

       

            arimdjonoks Artjoms Rimdjonoks
            uki Yuuki Enomoto
            Team C
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: