emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Problem report #132 [2/2]: base/src/emacs/src/process.c (procfs_system_p


From: Dan Nicolaescu
Subject: Problem report #132 [2/2]: base/src/emacs/src/process.c (procfs_system_process_attributes); UNINIT
Date: Tue, 02 Dec 2008 17:22:25 -0800

CID: 132
Checker: UNINIT (help)
File: base/src/emacs/src/process.c
Function: procfs_system_process_attributes
Description: Using uninitialized value "q"

Event var_decl: Declared variable "q" without initializer
Also see events: [uninit_use]

7246      char procbuf[1025], *p, *q;
7247      int fd;
7248      ssize_t nread;
7249      const char *cmd;
7250      char *cmdline = NULL;
7251      size_t cmdsize, cmdline_size;
7252      unsigned char c;
7253      int proc_id, ppid, uid, gid, pgrp, sess, tty, tpgid, thcount;
7254      unsigned long long utime, stime, cutime, cstime, start;
7255      long priority, nice, rss;
7256      unsigned long minflt, majflt, cminflt, cmajflt, vsize;
7257      time_t sec;
7258      unsigned usec;
7259      EMACS_TIME tnow, tstart, tboot, telapsed,ttotal;
7260      double pcpu, pmem;
7261      Lisp_Object attrs = Qnil;
7262      Lisp_Object cmd_str, decoded_cmd, tem;
7263      struct gcpro gcpro1, gcpro2;
7264      EMACS_INT uid_eint, gid_eint;
7265    

At conditional (1): "pid & 7 != 6" taking true path
At conditional (2): "pid & 7 != 0" taking false path
At conditional (3): "0" taking false path

7266      CHECK_NUMBER_OR_FLOAT (pid);

At conditional (4): "pid & 7 == 6" taking false path

7267      proc_id = FLOATP (pid) ? XFLOAT_DATA (pid) : XINT (pid);
7268      sprintf (procfn, "/proc/%lu", proc_id);

At conditional (5): "stat < 0" taking false path

7269      if (stat (procfn, &st) < 0)
7270        return attrs;
7271    
7272      GCPRO2 (attrs, decoded_cmd);
7273    
7274      /* euid egid */
7275      uid = st.st_uid;
7276      /* Use of EMACS_INT stops GCC whining about limited range of data 
type.  */
7277      uid_eint = uid;

At conditional (6): "uid_eint > 1152921504606846975" taking true path

7278      attrs = Fcons (Fcons (Qeuid, make_fixnum_or_float (uid_eint)), attrs);
7279      BLOCK_INPUT;
7280      pw = getpwuid (uid);

At conditional (7): "interrupt_input_blocked == 0" taking true path
At conditional (8): "interrupt_input_pending != 0" taking true path
At conditional (9): "pending_atimers != 0" taking true path
At conditional (10): "0" taking false path

7281      UNBLOCK_INPUT;

At conditional (11): "pw != 0" taking true path

7282      if (pw)
7283        attrs = Fcons (Fcons (Quser, build_string (pw->pw_name)), attrs);
7284    
7285      gid = st.st_gid;
7286      gid_eint = gid;

At conditional (12): "gid_eint > 1152921504606846975" taking true path

7287      attrs = Fcons (Fcons (Qegid, make_fixnum_or_float (gid_eint)), attrs);
7288      BLOCK_INPUT;
7289      gr = getgrgid (gid);

At conditional (13): "interrupt_input_blocked == 0" taking true path
At conditional (14): "interrupt_input_pending != 0" taking true path
At conditional (15): "pending_atimers != 0" taking true path
At conditional (16): "0" taking false path

7290      UNBLOCK_INPUT;

At conditional (17): "gr != 0" taking true path

7291      if (gr)
7292        attrs = Fcons (Fcons (Qgroup, build_string (gr->gr_name)), attrs);
7293    
7294      strcpy (fn, procfn);
7295      procfn_end = fn + strlen (fn);
7296      strcpy (procfn_end, "/stat");
7297      fd = emacs_open (fn, O_RDONLY, 0);

At conditional (18): "fd >= 0" taking true path
At conditional (19): "nread = emacs_read > 0" taking true path

7298      if (fd >= 0 && (nread = emacs_read (fd, procbuf, sizeof(procbuf) - 
1)) > 0)
7299        {
7300          procbuf[nread] = '\0';
7301          p = procbuf;
7302    
7303          cmd = NULL;
7304          p = strchr (p, '(');

At conditional (20): "p != 0" taking false path

7305          if (p != NULL)
7306            {
7307              q = strrchr (p + 1, ')');
7308              /* comm */
7309              if (q != NULL)
7310                {
7311                  cmd = p + 1;
7312                  cmdsize = q - cmd;
7313                }
7314            }

At conditional (21): "cmd == 0" taking true path

7315          if (cmd == NULL)
7316            {
7317              cmd = "???";
7318              cmdsize = 3;
7319            }
7320          /* Command name is encoded in locale-coding-system; decode it.  */
7321          cmd_str = make_unibyte_string (cmd, cmdsize);
7322          decoded_cmd = code_convert_string_norecord (cmd_str,
7323                                                      
Vlocale_coding_system, 0);
7324          attrs = Fcons (Fcons (Qcomm, decoded_cmd), attrs);
7325    

Event uninit_use: Using uninitialized value "q"
Also see events: [var_decl]

7326          if (q)
7327            {
7328              EMACS_INT ppid_eint, pgrp_eint, sess_eint, tpgid_eint, 
thcount_eint;




reply via email to

[Prev in Thread] Current Thread [Next in Thread]