-rw-r--r-- | src/eyefiservice.cc | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/eyefiservice.cc b/src/eyefiservice.cc index 5c4e308..9ef4bb6 100644 --- a/src/eyefiservice.cc +++ b/src/eyefiservice.cc | |||
@@ -193,25 +193,25 @@ int eyefiService::UploadPhoto( | |||
193 | 193 | ||
194 | std::string::size_type ls = tf.rfind('/'); | 194 | std::string::size_type ls = tf.rfind('/'); |
195 | // XXX: actually, lack of '/' signifies error here | 195 | // XXX: actually, lack of '/' signifies error here |
196 | std::string tbn = (ls==std::string::npos)?tf:tf.substr(ls+1); | 196 | std::string tbn = (ls==std::string::npos)?tf:tf.substr(ls+1); |
197 | ls = lf.rfind('/'); | 197 | ls = lf.rfind('/'); |
198 | std::string lbn = (ls==std::string::npos)?lf:lf.substr(ls+1); | 198 | std::string lbn = (ls==std::string::npos)?lf:lf.substr(ls+1); |
199 | std::string ttf,tlf; | 199 | std::string ttf,tlf; |
200 | bool success = false; | 200 | bool success = false; |
201 | for(int i=0;i<32767;++i) { | 201 | for(int i=0;i<32767;++i) { |
202 | const char *fmt = i ? "%1$s/(%3$05d)%2$s" : "%1$s/%2$s"; | 202 | const char *fmt = i ? "%1$s/(%3$05d)%2$s" : "%1$s/%2$s"; |
203 | ttf = (const char*)gnu::autosprintf(fmt,td.c_str(),tbn.c_str(),i); | 203 | ttf = (const char*)gnu::autosprintf(fmt,td.c_str(),tbn.c_str(),i); |
204 | if(!lf.empty()) tlf = (const char*)gnu::autosprintf(fmt,td.c_str(),lbn.c_str(),i); | 204 | if(!lf.empty()) tlf = (const char*)gnu::autosprintf(fmt,td.c_str(),lbn.c_str(),i); |
205 | if( (!link(tf.c_str(),ttf.c_str())) && (lf.empty()) || !link(lf.c_str(),tlf.c_str()) ) { | 205 | if( (!link(tf.c_str(),ttf.c_str())) && (lf.empty() || !link(lf.c_str(),tlf.c_str())) ) { |
206 | unlink(tf.c_str()); | 206 | unlink(tf.c_str()); |
207 | if(!lf.empty()) unlink(lf.c_str()); | 207 | if(!lf.empty()) unlink(lf.c_str()); |
208 | success=true; | 208 | success=true; |
209 | break; | 209 | break; |
210 | } | 210 | } |
211 | } | 211 | } |
212 | std::string cmd = eyekinfig.get_on_upload_photo(); | 212 | std::string cmd = eyekinfig.get_on_upload_photo(); |
213 | if(success && !cmd.empty()) { | 213 | if(success && !cmd.empty()) { |
214 | if(detached_child()) { | 214 | if(detached_child()) { |
215 | putenv( gnu::autosprintf("EYEFI_UPLOADED_ORIG=%s",tbn.c_str()) ); | 215 | putenv( gnu::autosprintf("EYEFI_UPLOADED_ORIG=%s",tbn.c_str()) ); |
216 | putenv( gnu::autosprintf("EYEFI_MACADDRESS=%s",macaddress.c_str()) ); | 216 | putenv( gnu::autosprintf("EYEFI_MACADDRESS=%s",macaddress.c_str()) ); |
217 | putenv( gnu::autosprintf("EYEFI_UPLOADED=%s",ttf.c_str()) ); | 217 | putenv( gnu::autosprintf("EYEFI_UPLOADED=%s",ttf.c_str()) ); |