return 0;
}
-void canned_fs_config(const char* path, int dir,
+int canned_fs_config(const char* path, int dir,
unsigned* uid, unsigned* gid, unsigned* mode, uint64_t* capabilities) {
Path key;
- key.path = path+1; // canned paths lack the leading '/'
+ key.path = path;
Path* p = (Path*) bsearch(&key, canned_data, canned_used, sizeof(Path), path_compare);
if (p == NULL) {
- fprintf(stderr, "failed to find [%s] in canned fs_config\n", path);
- exit(1);
+ return 0;
}
*uid = p->uid;
*gid = p->gid;
if (c_mode != *mode) printf("%s mode 0%o 0%o\n", path, *mode, c_mode);
if (c_capabilities != *capabilities) printf("%s capabilities %llx %llx\n", path, *capabilities, c_capabilities);
#endif
+
+ return 1;
}
#include <inttypes.h>
int load_canned_fs_config(const char* fn);
-void canned_fs_config(const char* path, int dir,
- unsigned* uid, unsigned* gid, unsigned* mode, uint64_t* capabilities);
+int canned_fs_config(const char* path, int dir,
+ unsigned* uid, unsigned* gid, unsigned* mode, uint64_t* capabilities);
#endif
void ext4_parse_sb_info(struct ext4_super_block *sb);
u16 ext4_crc16(u16 crc_in, const void *buf, int size);
-typedef void (*fs_config_func_t)(const char *path, int dir, unsigned *uid, unsigned *gid,
+typedef int (*fs_config_func_t)(const char *path, int dir, unsigned *uid, unsigned *gid,
unsigned *mode, uint64_t *capabilities);
struct selabel_handle;
unsigned int uid = 0;
unsigned int gid = 0;
int dir = S_ISDIR(stat.st_mode);
- fs_config_func(dentries[i].path, dir, &uid, &gid, &mode, &capabilities);
- dentries[i].mode = mode;
- dentries[i].uid = uid;
- dentries[i].gid = gid;
- dentries[i].capabilities = capabilities;
+ if (fs_config_func(dentries[i].path, dir, &uid, &gid, &mode, &capabilities)) {
+ dentries[i].mode = mode;
+ dentries[i].uid = uid;
+ dentries[i].gid = gid;
+ dentries[i].capabilities = capabilities;
+ }
}
if (S_ISREG(stat.st_mode)) {