Commit 86b5b992 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] kconfig: don't rename target dir when saving config

From: Roman Zippel <zippel@linux-m68k.org>

conf_write() now checks the target path whether it's a directory, so it
saves the config in the directory instead of renaming it.
parent dfc78642
...@@ -269,8 +269,14 @@ int conf_write(const char *name) ...@@ -269,8 +269,14 @@ int conf_write(const char *name)
dirname[0] = 0; dirname[0] = 0;
if (name && name[0]) { if (name && name[0]) {
char *slash = strrchr(name, '/'); struct stat st;
if (slash) { char *slash;
if (!stat(name, &st) && S_ISDIR(st.st_mode)) {
strcpy(dirname, name);
strcat(dirname, "/");
basename = conf_def_filename;
} else if ((slash = strrchr(name, '/'))) {
int size = slash - name + 1; int size = slash - name + 1;
memcpy(dirname, name, size); memcpy(dirname, name, size);
dirname[size] = 0; dirname[size] = 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment