projects
/
cycript.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
cd2e82f
)
Do not leave console socket lying around in /tmp.
author
Jay Freeman (saurik)
<saurik@saurik.com>
Tue, 11 Mar 2014 22:44:54 +0000
(15:44 -0700)
committer
Jay Freeman (saurik)
<saurik@saurik.com>
Tue, 11 Mar 2014 22:49:48 +0000
(15:49 -0700)
Console.cpp
patch
|
blob
|
blame
|
history
diff --git
a/Console.cpp
b/Console.cpp
index f93e090784629ccc10a3868e979cc8fcc559e353..945b9bcfcac964e4ec71e4ff21061393c4397ffd 100644
(file)
--- a/
Console.cpp
+++ b/
Console.cpp
@@
-814,19
+814,27
@@
int Main(int argc, char const * const argv[], char const * const envp[]) {
address.sun_family = AF_UNIX;
sprintf(address.sun_path, "/tmp/.s.cy.%u", getpid());
address.sun_family = AF_UNIX;
sprintf(address.sun_path, "/tmp/.s.cy.%u", getpid());
+ unlink(address.sun_path);
+
+ struct File {
+ const char *path_;
+
+ File(const char *path) :
+ path_(path)
+ {
+ }
+
+ ~File() {
+ unlink(path_);
+ }
+ } file(address.sun_path);
_syscall(bind(server, reinterpret_cast<sockaddr *>(&address), SUN_LEN(&address)));
_syscall(chmod(address.sun_path, 0777));
_syscall(bind(server, reinterpret_cast<sockaddr *>(&address), SUN_LEN(&address)));
_syscall(chmod(address.sun_path, 0777));
- try {
- _syscall(listen(server, 1));
- InjectLibrary(pid);
- client_ = _syscall(accept(server, NULL, NULL));
- } catch (...) {
- // XXX: exception?
- unlink(address.sun_path);
- throw;
- }
+ _syscall(listen(server, 1));
+ InjectLibrary(pid);
+ client_ = _syscall(accept(server, NULL, NULL));
} catch (...) {
_syscall(close(server));
throw;
} catch (...) {
_syscall(close(server));
throw;