get_veid_by_name(): fix working with long CT names
If CT name is longer than 50 characters it is never found, because
the buffer for CT name symlink (/etc/vz/names/$NAME) is only 64 bytes
long!
This is a problem because:
(1) you can assign such a long name but then it can not be used
(vzctl/vzlist does not recognize it);
(2) if there is another name which is exactly 50 chars long and
the first 50 chars of it are the same as ours this (wrong)
name will be picked up errorneously.
Fix by providing long enough buffer for CT name symlink. We are using
STR_SIZE and not PATH_LEN because other similar code (e.g. set_name())
uses the same constant (ideally we should've used PATH_MAX from limits.h).
While we are at it, also fix buffer size for storing CT name symlink
contents (i.e. path to CT config file). Again, other code (e.g.
run_action(), vps_create()) uses STR_SIZE for this.
Signed-off-by: Kir Kolyshkin <kir@openvz.org>
1 file changed