#include <vector>
#include <sys/wait.h>
+#include <sys/types.h>
+#include <sys/stat.h>
struct fat_header {
uint32_t magic;
const char *path(file->c_str());
const char *base = strrchr(path, '/');
char *temp(NULL), *dir;
+ mode_t mode = 0;
if (base != NULL)
dir = strndup(path, base++ - path + 1);
}
if (temp) {
+ struct stat info;
+ _syscall(stat(path, &info));
+ _syscall(chown(temp, info.st_uid, info.st_gid));
+ _syscall(chmod(temp, info.st_mode));
_syscall(unlink(path));
_syscall(rename(temp, path));
free(temp);