projects
/
dyn-nsupdate.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
48ce26b
)
cast last argument of execl; check for errors in dup2
author
Ralf Jung
<post@ralfj.de>
Fri, 9 Aug 2013 20:25:23 +0000
(22:25 +0200)
committer
Ralf Jung
<post@ralfj.de>
Fri, 9 Aug 2013 20:25:23 +0000
(22:25 +0200)
dyn-nsupdate.cpp
patch
|
blob
|
history
diff --git
a/dyn-nsupdate.cpp
b/dyn-nsupdate.cpp
index 4cb7ead86ec2ff1c178cffedee3cbb7037b66597..7c39136e37c1321795ccf7718eb59b4538e874ae 100644
(file)
--- a/
dyn-nsupdate.cpp
+++ b/
dyn-nsupdate.cpp
@@
-77,9
+77,12
@@
int main(int argc, const char ** argv)
/* We're in the child */
/* Close write end, use read and as stdin */
close(pipe_ends[1]);
/* We're in the child */
/* Close write end, use read and as stdin */
close(pipe_ends[1]);
- dup2(pipe_ends[0], fileno(stdin));
+ if (dup2(pipe_ends[0], fileno(stdin)) < 0) {
+ std::cerr << "There was an error redirecting stdin." << std::endl;
+ exit(1);
+ }
/* exec nsupdate */
/* exec nsupdate */
- execl(nsupdate.c_str(), nsupdate.c_str(), "-k", keyfile.c_str(), NULL);
+ execl(nsupdate.c_str(), nsupdate.c_str(), "-k", keyfile.c_str(),
(char *)
NULL);
/* There was an error */
std::cerr << "There was an error executing nsupdate." << std::endl;
exit(1);
/* There was an error */
std::cerr << "There was an error executing nsupdate." << std::endl;
exit(1);