Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
emacs
emacs
Commits
8a7777fc
Commit
8a7777fc
authored
May 02, 1998
by
Richard M. Stallman
Browse files
(Fmake_temp_name): Improve randomness of generated file names.
parent
ba88b322
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
4 deletions
+9
-4
src/fileio.c
src/fileio.c
+9
-4
No files found.
src/fileio.c
View file @
8a7777fc
...
...
@@ -862,12 +862,17 @@ PREFIX should be an absolute file name.")
while
(
1
)
{
struct
stat
ignored
;
unsigned num = make_temp_name_count
++
;
unsigned
num
=
make_temp_name_count
;
p
[
0
]
=
make_temp_name_tbl
[
num
&
63
],
num
>>=
6
;
p
[
1
]
=
make_temp_name_tbl
[
num
&
63
],
num
>>=
6
;
p
[
2
]
=
make_temp_name_tbl
[
num
&
63
],
num
>>=
6
;
/* Poor man's congruential RN generator. Replace with
++make_temp_name_count for debugging. */
make_temp_name_count
+=
25229
;
make_temp_name_count
%=
225307
;
if
(
stat
(
data
,
&
ignored
)
<
0
)
{
/* We want to return only if errno is ENOENT. */
...
...
@@ -878,9 +883,9 @@ PREFIX should be an absolute file name.")
can do. The alternatives are to return nil, which is
as bad as (and in many cases worse than) throwing the
error, or to ignore the error, which will likely result
in looping through 2
62144
stat's, which is not only
SLOW
, but also useless since it will fallback to
the
errow below, anyway. */
in looping through 2
25307
stat's, which is not only
dog-slow
, but also useless since it will fallback to
the
errow below, anyway. */
report_file_error
(
"Cannot create temporary name for prefix `%s'"
,
Fcons
(
prefix
,
Qnil
));
/* not reached */
...
...
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