On Sun, 24 Feb 2008 17:12:17 +0100 Julien BLACHE <jb at jblache.org> wrote:
> Hi,
[...]
> ftok() returns -1 in this case, but this isn't checked for in this
> code, so it happily goes on and semget(0xffffffff, 1, ...).
[...]

ftok() require a filename, but it does not have to be the pathname of any 
scanner device. Since we have an address in the form of 
libusb:<busnumber>:<devicenumber> I suggest to create 
/tmp/libusb:<busnumber>:<devicenumber> prior to getting the lock. I am not sure 
if this is better than any other file system level lock. The empty file may be 
left there, since it doesn't hurt anyone.

BTW, the problem might be solved on linux platform, switching to pthread. Am I 
correct?

Bye,
Giuseppe

Reply via email to