Commit e00553bf authored by Eli Zaretskii's avatar Eli Zaretskii

(Fuser_uid, Fuser_real_uid): If UID as EMACS_INT is negative, produce

a float value.
parent 51105b13
2009-03-20 Eli Zaretskii <eliz@gnu.org>
* editfns.c (Fuser_uid, Fuser_real_uid): If UID as EMACS_INT is
negative, produce a float value.
* dired.c (make_uid, make_gid): New functions.
(Ffile_attributes): Use them to avoid negative UID and GID.
2009-03-20 Juanma Barranquero <lekktu@gmail.com>
* keyboard.c (Fcurrent_idle_time): Reflow docstring.
......
......@@ -1319,23 +1319,33 @@ This ignores the environment variables LOGNAME and USER, so it differs from
DEFUN ("user-uid", Fuser_uid, Suser_uid, 0, 0, 0,
doc: /* Return the effective uid of Emacs.
Value is an integer or float, depending on the value. */)
Value is an integer or a float, depending on the value. */)
()
{
/* Assignment to EMACS_INT stops GCC whining about limited range of
data type. */
EMACS_INT euid = geteuid ();
/* Make sure we don't produce a negative UID due to signed integer
overflow. */
if (euid < 0)
return make_float ((double)geteuid ());
return make_fixnum_or_float (euid);
}
DEFUN ("user-real-uid", Fuser_real_uid, Suser_real_uid, 0, 0, 0,
doc: /* Return the real uid of Emacs.
Value is an integer or float, depending on the value. */)
Value is an integer or a float, depending on the value. */)
()
{
/* Assignment to EMACS_INT stops GCC whining about limited range of
data type. */
EMACS_INT uid = getuid ();
/* Make sure we don't produce a negative UID due to signed integer
overflow. */
if (uid < 0)
return make_float ((double)getuid ());
return make_fixnum_or_float (uid);
}
......
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