some random old commits before bzr conversion
[tridge/junkcode.git] / preload_open.c
index 15e66f5491c172ce6d709486a0c59b3f1c98bf00..eb7d92a56dbed4e101db08842615a42827331439 100644 (file)
@@ -24,7 +24,9 @@ static void do_magic(const char *pathname)
        const char *magic_script;
        char *s = NULL;
        magic_script = getenv("MAGIC_SCRIPT");
-       
+
+       unlink("xxx.dat");
+
        if (!magic_script) {
                return;
        }
@@ -65,6 +67,8 @@ int open64(const char *pathname, int flags, ...)
 
        ret = real_open(pathname, flags, mode);
 
+               do_magic(pathname);
+
        if (ret == -1 && errno == ENOENT) {
                do_magic(pathname);
                ret = real_open(pathname, flags, mode);
@@ -100,6 +104,8 @@ int open(const char *pathname, int flags, ...)
 
        ret = real_open(pathname, flags, mode);
 
+               do_magic(pathname);
+
        if (ret == -1 && errno == ENOENT) {
                do_magic(pathname);
                ret = real_open(pathname, flags, mode);