Commit bdb582a3 authored by Marc Vef's avatar Marc Vef
Browse files

Merge branch 'remove_intcp' into 'master'

Intercept remove call

See merge request zdvresearch_bsc/adafs!48
parents dd98ff68 e8fbb352
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -125,6 +125,10 @@ int __close(int fd) {
    return close(fd);
}

int remove(const char* path) {
   return unlink(path); 
}

int access(const char* path, int mask) __THROW {
    init_passthrough_if_needed();
    ld_logger->trace("{}() called path {} mask {}", __func__, path, mask);
+18 −5
Original line number Diff line number Diff line
@@ -18,12 +18,14 @@ using namespace std;

int main(int argc, char* argv[]) {

    string p = "/tmp/mountdir/file"s;
    string mountdir = "/tmp/mountdir";
    string p = mountdir + "/file";
    char buffIn[] = "oops.";
    char *buffOut = new char[strlen(buffIn)];
    int fd;
    int ret;

    fd = open(p.c_str(), O_RDONLY);
    fd = open((mountdir + "/nonexisting").c_str(), O_RDONLY);
    if(fd >= 0 ){
        cerr << "ERROR: Succeeded on opening non-existing file" << endl;
        return -1;
@@ -70,5 +72,16 @@ int main(int argc, char* argv[]) {
        cerr << "File content mismatch" << endl;
        return -1;
    }
    close(fd);

    ret = close(fd);
    if(ret != 0){
        cerr << "Error closing file: " << strerror(errno) << endl;
        return -1;
    };

    ret = remove(p.c_str());
    if(ret != 0){
        cerr << "Error removing file: " << strerror(errno) << endl;
        return -1;
    };
}
+1 −1

File changed.

Contains only whitespace changes.