+ rc = 1;
+ if (tmpfile) {
+ if (chmod(tmpfile, mode) == -1) {
+ fprintf(stderr, "can't chmod %s: %s\n", tmpfile,
+ strerror(errno));
+ rc = 0;
+ } else if (rename(tmpfile, path) == -1) {
+ fprintf(stderr, "extract rename failed: %s\n",
+ strerror(errno));
+ rc = 0;
+ }
+ }
+
+ if (rc == 0 && tmpfile) {
+ if (unlink(tmpfile) == -1) {
+ fprintf(stderr, "unlink tmpfile %s fail: %s\n",
+ tmpfile,
+ strerror(errno));
+ }
+ }
+
+ return rc;