From 60731e6d02c4ebeb0700bc1c6a53261159049e01 Mon Sep 17 00:00:00 2001 From: Adam Ierymenko Date: Tue, 7 Jan 2014 16:37:36 -0800 Subject: Update URLs for auto-update, check supernode version in one more place, delete pid before executing updater. --- main.cpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'main.cpp') diff --git a/main.cpp b/main.cpp index dfb00fc5..88c8787e 100644 --- a/main.cpp +++ b/main.cpp @@ -487,8 +487,10 @@ int main(int argc,char **argv) case Node::NODE_RESTART_FOR_UPGRADE: { #ifdef __UNIX_LIKE__ const char *upgPath = node->reasonForTermination(); - if (upgPath) - execl(upgPath,upgPath,"-s",(char *)0); // -s = (re)start after install/upgrade + if (upgPath) { + Utils::rm((std::string(homeDir)+"/zerotier-one.pid").c_str()); + execl(upgPath,upgPath,(char *)0); + } exitCode = 2; fprintf(stderr,"%s: abnormal termination: unable to execute update at %s\n",argv[0],(upgPath) ? upgPath : "(unknown path)"); #endif @@ -506,11 +508,7 @@ int main(int argc,char **argv) } catch ( ... ) {} #ifdef __UNIX_LIKE__ - { - char pidpath[4096]; - Utils::snprintf(pidpath,sizeof(pidpath),"%s/zerotier-one.pid",homeDir); - Utils::rm(pidpath); - } + Utils::rm((std::string(homeDir)+"/zerotier-one.pid").c_str()); #endif return exitCode; -- cgit v1.2.3