index bb89fb02dc9a8a1a09492fb32d8708f952afe47e..066f62195508033a5f72504e4805ea436424296e 100644 (file)
--- a/path.c
+++ b/path.c
* which is what it's designed for.
*/
#include "cache.h"
-#include <pwd.h>
static char bad_path[] = "/bad-path/";
: 0));
if (S_ISDIR(mode))
mode |= S_ISGID;
- if (chmod(path, mode) < 0)
+ if ((mode & st.st_mode) != mode && chmod(path, mode) < 0)
return -2;
return 0;
}