projects
/
sudo
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
c7c8554
)
Rewind stream if we fdopen sudoers since it may not be at the beginning.
author
Todd C. Miller
<Todd.Miller@courtesan.com>
Thu, 16 Apr 2009 12:22:04 +0000
(12:22 +0000)
committer
Todd C. Miller
<Todd.Miller@courtesan.com>
Thu, 16 Apr 2009 12:22:04 +0000
(12:22 +0000)
Set the keepopen flag on already-open files too so the lexer doesn't
close them out from under us.
visudo.c
patch
|
blob
|
history
diff --git
a/visudo.c
b/visudo.c
index 06d3b622c266e97641be78bb4ac7bd92191403e7..e9098f76741c4374f942eadff89b099251809364 100644
(file)
--- a/
visudo.c
+++ b/
visudo.c
@@
-782,8
+782,6
@@
open_sudoers(path, keepopen)
sudoerslist.last->next = entry;
sudoerslist.last = entry;
}
- if (keepopen != NULL)
- *keepopen = TRUE;
} else {
/* Already exists, open .tmp version if there is one. */
if (entry->tpath != NULL) {
@@
-792,8
+790,11
@@
open_sudoers(path, keepopen)
} else {
if ((fp = fdopen(entry->fd, "r")) == NULL)
error(1, "%s", entry->path);
+ rewind(fp);
}
}
+ if (keepopen != NULL)
+ *keepopen = TRUE;
return(fp);
}