+#define _GNU_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
if (fd == -1) {
_LOGE("FAIL : open %s : %s", dir,
strerror_r(errno, buf, sizeof(buf)));
+ free(fullpath);
return -1;
}
ret = fstat(fd, &sb);
_LOGE("FAIL : fstat %s : %s", dir,
strerror_r(errno, buf, sizeof(buf)));
close(fd);
+ free(fullpath);
return -1;
}
if (S_ISLNK(sb.st_mode)) {
_LOGE("FAIL : %s is symlink!", dir);
close(fd);
+ free(fullpath);
return -1;
}
ret = fchown(fd, uid, gid);
_LOGE("FAIL : fchown %s %d.%d, because %s", dir, uid,
gid, strerror_r(errno, buf, sizeof(buf)));
close(fd);
+ free(fullpath);
return -1;
}
close(fd);