diff --git a/src/util.c b/src/util.c
index 573e8a717efbe843fce003126cb932928b15f716..2f62c29ce40ac012993e1d208d65491b56d204aa 100644
--- a/src/util.c
+++ b/src/util.c
@@ -19,13 +19,8 @@
assert(strlen(path) <= PATH_MAX);
strcpy(p, path);
- t = dirname(path);
+ t = dirname(p);
memmove(dname, t, strlen(t) + 1);
-
- /* restore the path if dirname worked in-place */
- if (t == path && path != dname) {
- strcpy(path, p);
- }
}
/** Make directory and all of its parents */