[Users] [PATCH] vzctl - vps_save_config
Philipp Wehrheim
flipstar at gmx.net
Wed Nov 4 02:54:45 EST 2009
Hey,
the attached patch fixes an issue where vzctl overwrites the symlink
to CTs config.
In my setup the CT config is stored in /vz/ve/<CTID>/<CTID>.conf
and linked back to /etc/vz/conf/<CTID>.conf .If I make changes to the
CTs config via "vzctl set ..." the link is overwritten by vzctl on writeback.
Please consider applying.
cheers
flip
--- a/src/lib/config.c 2009-11-04 08:39:18.000000000 +0100
+++ b/src/lib/config.c 2009-11-04 08:39:18.000000000 +0100
@@ -2351,6 +2351,8 @@
vps_param *tmp_old_p = NULL;
list_head_t conf, new_conf;
int ret, n;
+ char buf[4096];
+ ssize_t llen;
list_head_init(&conf);
list_head_init(&new_conf);
@@ -2359,6 +2361,13 @@
vps_parse_config(veid, path, tmp_old_p, action);
old_p = tmp_old_p;
}
+
+ /* if path is a symlink dereference it */
+ if ((llen = readlink(path, buf, sizeof(buf)-1)) != -1) {
+ buf[llen] = '\0';
+ strcpy(path,buf);
+ }
+
if ((ret = read_conf(path, &conf)))
return ret;
n = store(old_p, new_p, &new_conf);
More information about the Users
mailing list