Commit ead42dd2 authored by Sebastian Oeste's avatar Sebastian Oeste
Browse files

fix: avoid implicit cast int -> bool.

* Add != 0 when working on ints.
parent 2b7c39f4
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -41,11 +41,11 @@ int adafs_chmod(const char* p, mode_t mode, struct fuse_file_info* fi) {
    auto md = make_shared<Metadata>();
    auto err = get_metadata(*md, path);

    if (err) return err;
    if (err != 0) return err;

    // for change_access only the uid matters AFAIK
    err = chk_uid(*md);
    if (err) return err;
    if (err != 0) return err;

    return change_access(*md, mode, path);
}
@@ -64,11 +64,11 @@ int adafs_chown(const char* p, uid_t uid, gid_t gid, struct fuse_file_info* fi)
    auto md = make_shared<Metadata>();
    auto err = get_metadata(*md, path);

    if (err) return err;
    if (err != 0) return err;

    // any ownership change requires the user of the object
    err = chk_uid(*md);
    if (err) return err;
    if (err != 0) return err;

    return change_permissions(*md, uid, gid, path);
}
+3 −3
Original line number Diff line number Diff line
@@ -145,14 +145,14 @@ int adafs_rmdir(const char* p) {

    // remove dentry XXX duplicate code in adafs_unlink()
    auto err = remove_dentry(ADAFS_DATA->hashf(path.parent_path().string()), path.filename().string());
    if (err) return err;
    if (err != 0) return err;

    // remove dentry directory
    destroy_dentry_dir(ADAFS_DATA->hashf(path.string()));

    // remove directory inode
    err = remove_metadata(ADAFS_DATA->hashf(path.string()));
    if (err) return err;
    if (err != 0) return err;

    return 0;
}
+4 −4
Original line number Diff line number Diff line
@@ -108,7 +108,7 @@ int adafs_create(const char* p, mode_t mode, struct fuse_file_info* fi) {
    ADAFS_DATA->logger->debug("##### FUSE FUNC ###### adafs_create() enter: name '{}' mode {}", p, mode);

    auto err = static_cast<int>(adafs_mknod(p, mode, 0));
    if (err) return err;
    if (err != 0) return err;
#ifdef CHECK_ACCESS
    err = adafs_open(p, fi);
#endif
@@ -171,11 +171,11 @@ int adafs_unlink(const char* p) {

    // adafs_access was called first by the VFS. Thus, path exists and access is ok (not guaranteed though!).
    auto err = remove_dentry(ADAFS_DATA->hashf(path.parent_path().string()), path.filename().string());
    if (err) return err;
    if (err != 0) return err;

    // remove inode
    err = remove_metadata(ADAFS_DATA->hashf(path.string()));
    if (err) return err;
    if (err != 0) return err;

    // XXX delete unused data blocks (asynchronously)
    // XXX currently just throws away the data directory on disk