~ubuntu-dev/ubuntu/lucid/zabbix/lucid-201002110857

« back to all changes in this revision

Viewing changes to src/libs/zbxsysinfo/hpux/memory.c

  • Committer: Bazaar Package Importer
  • Author(s): Michael Ablassmeier
  • Date: 2007-07-02 09:06:51 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20070702090651-8l6fl3fjw9rh6l2u
Tags: 1:1.4.1-2
Add patch from SVN in order to fix Incorrect processing of character '%'
in user parameters and remote commands.

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18
18
**/
19
19
 
20
 
#include "config.h"
21
 
 
22
20
#include "common.h"
 
21
 
23
22
#include "sysinfo.h"
24
23
 
25
24
static int      VM_MEMORY_CACHED(const char *cmd, const char *param, unsigned flags, AGENT_RESULT *result)
34
33
 
35
34
        init_result(result);
36
35
 
37
 
        f=fopen("/proc/meminfo","r");
38
 
        if(NULL == f)
 
36
        if(NULL == (f = fopen("/proc/meminfo","r")))
39
37
        {
40
38
                return  SYSINFO_RET_FAIL;
41
39
        }
 
40
 
42
41
        while(NULL!=fgets(c,MAX_STRING_LEN,f))
43
42
        {
44
43
                if(strncmp(c,"Cached:",7) == 0)
56
55
                        break;
57
56
                }
58
57
        }
59
 
        fclose(f);
 
58
        zbx_fclose(f);
60
59
 
61
60
        SET_UI64_RESULT(result, res);
62
61
        return SYSINFO_RET_OK;
387
386
                return SYSINFO_RET_FAIL;
388
387
        }
389
388
 
390
 
        if(get_param(param, 1, mode, MAX_STRING_LEN) != 0)
 
389
        if(get_param(param, 1, mode, sizeof(mode)) != 0)
391
390
        {
392
391
                mode[0] = '\0';
393
392
        }
395
394
        if(mode[0] == '\0')
396
395
        {
397
396
                /* default parameter */
398
 
                sprintf(mode, "total");
 
397
                zbx_snprintf(mode, sizeof(mode), "total");
399
398
        }
400
399
        
401
400
        for(i=0; fl[i].mode!=0; i++)