diff options
| author | Paul Eggert | 2011-10-25 22:22:54 -0700 |
|---|---|---|
| committer | Paul Eggert | 2011-10-25 22:22:54 -0700 |
| commit | 225a2cff910d3fbc2cca2cdef6d3eecfce9e74e5 (patch) | |
| tree | 0941f89624f451eb0989e58b2fab4bfd842ad7ee | |
| parent | eacd378d0b36f57de3efe3ff13949258407bd206 (diff) | |
| download | emacs-225a2cff910d3fbc2cca2cdef6d3eecfce9e74e5.tar.gz emacs-225a2cff910d3fbc2cca2cdef6d3eecfce9e74e5.zip | |
* sysdep.c (system_process_attributes): Simplify pid_t handling.
| -rw-r--r-- | src/ChangeLog | 6 | ||||
| -rw-r--r-- | src/sysdep.c | 20 |
2 files changed, 5 insertions, 21 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 2f825a37971..7d28913b0ce 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | 2011-10-25 Paul Eggert <eggert@cs.ucla.edu> | 1 | 2011-10-26 Paul Eggert <eggert@cs.ucla.edu> |
| 2 | 2 | ||
| 3 | Fix integer width and related bugs. | 3 | Fix integer width and related bugs. |
| 4 | * alloc.c (pure_bytes_used_lisp, pure_bytes_used_non_lisp): | 4 | * alloc.c (pure_bytes_used_lisp, pure_bytes_used_non_lisp): |
| @@ -627,8 +627,8 @@ | |||
| 627 | Don't assume pid_t fits in int; on 64-bit AIX pid_t is 64-bit. | 627 | Don't assume pid_t fits in int; on 64-bit AIX pid_t is 64-bit. |
| 628 | (emacs_read, emacs_write): | 628 | (emacs_read, emacs_write): |
| 629 | Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough. | 629 | Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough. |
| 630 | (system_process_attributes): Don't assume uid_t, gid_t, and | 630 | (system_process_attributes): Don't assume uid_t, gid_t, EMACS_INT, |
| 631 | double all fit in int or even EMACS_INT. | 631 | and double all fit in int. |
| 632 | * term.c (set_tty_color_mode): | 632 | * term.c (set_tty_color_mode): |
| 633 | Check that fixnums are in proper range for system types. | 633 | Check that fixnums are in proper range for system types. |
| 634 | * termhooks.h (struct input_event): | 634 | * termhooks.h (struct input_event): |
diff --git a/src/sysdep.c b/src/sysdep.c index efc627e80b7..9b4bd088046 100644 --- a/src/sysdep.c +++ b/src/sysdep.c | |||
| @@ -2705,15 +2705,7 @@ system_process_attributes (Lisp_Object pid) | |||
| 2705 | struct gcpro gcpro1, gcpro2; | 2705 | struct gcpro gcpro1, gcpro2; |
| 2706 | 2706 | ||
| 2707 | CHECK_NUMBER_OR_FLOAT (pid); | 2707 | CHECK_NUMBER_OR_FLOAT (pid); |
| 2708 | if (FLOATP (pid)) | 2708 | CONS_TO_INTEGER (pid, pid_t, proc_id); |
| 2709 | { | ||
| 2710 | double v = XFLOAT_DATA (pid); | ||
| 2711 | if (! (TYPE_MINIMUM (pid_t) <= v && v < TYPE_MAXIMUM (pid_t) + 1.0)) | ||
| 2712 | return attrs; | ||
| 2713 | proc_id = v; | ||
| 2714 | } | ||
| 2715 | else | ||
| 2716 | proc_id = XINT (pid); | ||
| 2717 | sprintf (procfn, "/proc/%"pMd, proc_id); | 2709 | sprintf (procfn, "/proc/%"pMd, proc_id); |
| 2718 | if (stat (procfn, &st) < 0) | 2710 | if (stat (procfn, &st) < 0) |
| 2719 | return attrs; | 2711 | return attrs; |
| @@ -2978,15 +2970,7 @@ system_process_attributes (Lisp_Object pid) | |||
| 2978 | struct gcpro gcpro1, gcpro2; | 2970 | struct gcpro gcpro1, gcpro2; |
| 2979 | 2971 | ||
| 2980 | CHECK_NUMBER_OR_FLOAT (pid); | 2972 | CHECK_NUMBER_OR_FLOAT (pid); |
| 2981 | if (FLOATP (pid)) | 2973 | CONS_TO_INTEGER (pid, pid_t, proc_id); |
| 2982 | { | ||
| 2983 | double v = XFLOAT_DATA (pid); | ||
| 2984 | if (! (TYPE_MINIMUM (pid_t) <= v && v < TYPE_MAXIMUM (pid_t) + 1.0)) | ||
| 2985 | return attrs; | ||
| 2986 | proc_id = v; | ||
| 2987 | } | ||
| 2988 | else | ||
| 2989 | proc_id = XINT (v); | ||
| 2990 | sprintf (procfn, "/proc/%"pMd, proc_id); | 2974 | sprintf (procfn, "/proc/%"pMd, proc_id); |
| 2991 | if (stat (procfn, &st) < 0) | 2975 | if (stat (procfn, &st) < 0) |
| 2992 | return attrs; | 2976 | return attrs; |