summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Marangi2024-11-26 19:56:39 +0000
committerChristian Marangi2024-11-26 21:05:50 +0000
commit10f7996ec29449915640acca5d65b592365a4b14 (patch)
treefbe64bebcb915be2a95448dac002b309a8554f99
parent5781664d5087ccc4b5ab58505883231212dbedbc (diff)
downloaduci-10f7996ec29449915640acca5d65b592365a4b14.tar.gz
file: Ignore config file with '.' in name
Uci doesn't support files with '.' in the config name and also have parsing problems confusing option section with the actual filename. Example: hello.apk-new is parsed as hello filename and apk-new section To correctly handle and prevent any kind of error, skip parsing these file entirely. This is now needed for APK support as it does generate config with a .apk-new suffix if a config already exist and the package is updated. Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
-rw-r--r--file.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/file.c b/file.c
index 6610f53..9db8dbd 100644
--- a/file.c
+++ b/file.c
@@ -832,6 +832,9 @@ done:
* after the last '/' character. By checking for a non-'\0'
* character afterwards, directories are ignored (glob marks
* those with a trailing '/'
+ * Filename with '.' are ignored and not parsed. Uci doesn't
+ * permit config files with '.' in the name and cause parsing
+ * problems.
*/
static inline char *get_filename(char *path)
{
@@ -841,6 +844,10 @@ static inline char *get_filename(char *path)
p++;
if (!*p)
return NULL;
+
+ if (strrchr(p, '.'))
+ return NULL;
+
return p;
}