Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
emacs
emacs
Commits
e00553bf
Commit
e00553bf
authored
Mar 20, 2009
by
Eli Zaretskii
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(Fuser_uid, Fuser_real_uid): If UID as EMACS_INT is negative, produce
a float value.
parent
51105b13
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
2 deletions
+20
-2
src/ChangeLog
src/ChangeLog
+8
-0
src/editfns.c
src/editfns.c
+12
-2
No files found.
src/ChangeLog
View file @
e00553bf
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.
...
...
src/editfns.c
View file @
e00553bf
...
...
@@ -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
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment