summaryrefslogtreecommitdiff
path: root/legacy/ecore/src/lib/ecore_file/ecore_file.c
diff options
context:
space:
mode:
authorSebastian Dransfeld <sd@tango.flipp.net>2008-09-02 05:38:46 +0000
committerSebastian Dransfeld <sd@tango.flipp.net>2008-09-02 05:38:46 +0000
commit2d2c1176df04c6914f980160b602b41d3a530599 (patch)
tree7b18d6017c529f5e0c494b6140d7d3b8490c2490 /legacy/ecore/src/lib/ecore_file/ecore_file.c
parent4851309c8b0b83e657a1b63a6bc2ac630ebffc2c (diff)
formatting
SVN revision: 35791
Diffstat (limited to '')
-rw-r--r--legacy/ecore/src/lib/ecore_file/ecore_file.c72
1 files changed, 36 insertions, 36 deletions
diff --git a/legacy/ecore/src/lib/ecore_file/ecore_file.c b/legacy/ecore/src/lib/ecore_file/ecore_file.c
index ecb7b515f0..b458b1d9c1 100644
--- a/legacy/ecore/src/lib/ecore_file/ecore_file.c
+++ b/legacy/ecore/src/lib/ecore_file/ecore_file.c
@@ -311,49 +311,49 @@ ecore_file_mv(const char *src, const char *dst)
311 stat(src, &st); 311 stat(src, &st);
312 if (S_ISREG(st.st_mode)) 312 if (S_ISREG(st.st_mode))
313 { 313 {
314 // Since we can't directly rename, try to 314 // Since we can't directly rename, try to
315 // copy to temp file in the dst directory 315 // copy to temp file in the dst directory
316 // and then rename. 316 // and then rename.
317 snprintf(buf, sizeof(buf), "%s/.%s.tmp.XXXXXX", 317 snprintf(buf, sizeof(buf), "%s/.%s.tmp.XXXXXX",
318 ecore_file_dir_get(dst), 318 ecore_file_dir_get(dst),
319 ecore_file_file_get(dst)); 319 ecore_file_file_get(dst));
320 fd = mkstemp(buf); 320 fd = mkstemp(buf);
321 if(fd < 0) 321 if (fd < 0)
322 { 322 {
323 perror("mkstemp"); 323 perror("mkstemp");
324 goto FAIL; 324 goto FAIL;
325 } 325 }
326 close(fd); 326 close(fd);
327 327
328 // Copy to temp file 328 // Copy to temp file
329 if(!ecore_file_cp(src,buf)) 329 if (!ecore_file_cp(src, buf))
330 goto FAIL; 330 goto FAIL;
331 331
332 // Set file permissions of temp file to match src 332 // Set file permissions of temp file to match src
333 chmod(buf, st.st_mode); 333 chmod(buf, st.st_mode);
334 334
335 // Try to atomically move temp file to dst 335 // Try to atomically move temp file to dst
336 if (rename(buf, dst)) 336 if (rename(buf, dst))
337 { 337 {
338 // If we still cannot atomically move 338 // If we still cannot atomically move
339 // do a normal copy and hope for the best. 339 // do a normal copy and hope for the best.
340 if(!ecore_file_cp(buf, dst)) 340 if (!ecore_file_cp(buf, dst))
341 goto FAIL; 341 goto FAIL;
342 } 342 }
343 343
344 // Delete temporary file and src 344 // Delete temporary file and src
345 ecore_file_unlink(buf); 345 ecore_file_unlink(buf);
346 ecore_file_unlink(src); 346 ecore_file_unlink(src);
347 goto PASS; 347 goto PASS;
348 } 348 }
349 } 349 }
350 goto FAIL; 350 goto FAIL;
351 } 351 }
352 352
353 PASS: 353PASS:
354 return 1; 354 return 1;
355 355
356 FAIL: 356FAIL:
357 return 0; 357 return 0;
358} 358}
359 359