Commit 225a2cff authored by Paul Eggert's avatar Paul Eggert

* sysdep.c (system_process_attributes): Simplify pid_t handling.

parent eacd378d
2011-10-25 Paul Eggert <eggert@cs.ucla.edu>
2011-10-26 Paul Eggert <eggert@cs.ucla.edu>
Fix integer width and related bugs.
* alloc.c (pure_bytes_used_lisp, pure_bytes_used_non_lisp):
......@@ -627,8 +627,8 @@
Don't assume pid_t fits in int; on 64-bit AIX pid_t is 64-bit.
(emacs_read, emacs_write):
Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough.
(system_process_attributes): Don't assume uid_t, gid_t, and
double all fit in int or even EMACS_INT.
(system_process_attributes): Don't assume uid_t, gid_t, EMACS_INT,
and double all fit in int.
* term.c (set_tty_color_mode):
Check that fixnums are in proper range for system types.
* termhooks.h (struct input_event):
......
......@@ -2705,15 +2705,7 @@ system_process_attributes (Lisp_Object pid)
struct gcpro gcpro1, gcpro2;
CHECK_NUMBER_OR_FLOAT (pid);
if (FLOATP (pid))
{
double v = XFLOAT_DATA (pid);
if (! (TYPE_MINIMUM (pid_t) <= v && v < TYPE_MAXIMUM (pid_t) + 1.0))
return attrs;
proc_id = v;
}
else
proc_id = XINT (pid);
CONS_TO_INTEGER (pid, pid_t, proc_id);
sprintf (procfn, "/proc/%"pMd, proc_id);
if (stat (procfn, &st) < 0)
return attrs;
......@@ -2978,15 +2970,7 @@ system_process_attributes (Lisp_Object pid)
struct gcpro gcpro1, gcpro2;
CHECK_NUMBER_OR_FLOAT (pid);
if (FLOATP (pid))
{
double v = XFLOAT_DATA (pid);
if (! (TYPE_MINIMUM (pid_t) <= v && v < TYPE_MAXIMUM (pid_t) + 1.0))
return attrs;
proc_id = v;
}
else
proc_id = XINT (v);
CONS_TO_INTEGER (pid, pid_t, proc_id);
sprintf (procfn, "/proc/%"pMd, proc_id);
if (stat (procfn, &st) < 0)
return attrs;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment