From 53edb5d92907f9dd3f0dff06eff83cc864345e00 Mon Sep 17 00:00:00 2001 From: "hans@rhel5-devel.localdomain" Date: Thu, 16 Apr 2009 11:26:54 +0200 Subject: libv4l: if the card name contains a / replace it with a - in the shm name From: Hans de Goede / is not allowed inside shm names, so if the card name contains a / replace it with a - Priority: normal Signed-off-by: Hans de Goede --- v4l2-apps/libv4l/ChangeLog | 2 ++ v4l2-apps/libv4l/libv4lconvert/control/libv4lcontrol.c | 7 ++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/v4l2-apps/libv4l/ChangeLog b/v4l2-apps/libv4l/ChangeLog index 6081e26cf..ebe34fb7f 100644 --- a/v4l2-apps/libv4l/ChangeLog +++ b/v4l2-apps/libv4l/ChangeLog @@ -1,6 +1,8 @@ libv4l-0.5.98 ------------- * Genius E-M 112 needs both upside down and whitebalance flags +* Some makefile improvements by Gregor Jasny +* If the card name contains a / replace it with a - in the shm name libv4l-0.5.97 ------------- diff --git a/v4l2-apps/libv4l/libv4lconvert/control/libv4lcontrol.c b/v4l2-apps/libv4l/libv4lconvert/control/libv4lcontrol.c index ff9b3b5c1..4834c786a 100644 --- a/v4l2-apps/libv4l/libv4lconvert/control/libv4lcontrol.c +++ b/v4l2-apps/libv4l/libv4lconvert/control/libv4lcontrol.c @@ -172,7 +172,7 @@ static void v4lcontrol_init_flags(struct v4lcontrol_data *data) struct v4lcontrol_data *v4lcontrol_create(int fd) { int shm_fd; - int init = 0; + int i, init = 0; char *s, shm_name[256]; struct v4l2_capability cap; @@ -184,6 +184,11 @@ struct v4lcontrol_data *v4lcontrol_create(int fd) syscall(SYS_ioctl, fd, VIDIOC_QUERYCAP, &cap); snprintf(shm_name, 256, "/%s:%s", cap.bus_info, cap.card); + /* / is not allowed inside shm names */ + for (i = 1; shm_name[i]; i++) + if (shm_name[i] == '/') + shm_name[i] = '-'; + /* Open the shared memory object identified by shm_name */ if ((shm_fd = shm_open(shm_name, (O_CREAT | O_EXCL | O_RDWR), (S_IREAD | S_IWRITE))) >= 0) -- cgit v1.2.3