Explorar el Código

LibC: Prevent remove from calling rmdir when unlink succeeds.

Mart G hace 4 años
padre
commit
86a9e26996
Se han modificado 1 ficheros con 3 adiciones y 3 borrados
  1. 3 3
      Userland/Libraries/LibC/stdio.cpp

+ 3 - 3
Userland/Libraries/LibC/stdio.cpp

@@ -1152,9 +1152,9 @@ int pclose(FILE* stream)
 int remove(const char* pathname)
 int remove(const char* pathname)
 {
 {
     int rc = unlink(pathname);
     int rc = unlink(pathname);
-    if (rc < 0 && errno != EISDIR)
-        return -1;
-    return rmdir(pathname);
+    if (rc < 0 && errno == EISDIR)
+        return rmdir(pathname);
+    return rc;
 }
 }
 
 
 int scanf(const char* fmt, ...)
 int scanf(const char* fmt, ...)