At this point path must point to an allocated string since otherwise the
asprintf that makes the allocation would have failed and we would have
returned earlier.
This applies the same pattern as used in other error cases in this block - and
cleans up the file desciptors and allocated memory too.
Signed-off-by: Rob Bradford <rob@linux.intel.com>
readlink() returns the number of bytes that it has written excluding any NUL
byte (since it does not write that itself.) This could lead to attempting to
access beyond the end of buffer if the destination of the link is exactly 100
bytes long. The standard solution to this is to subtract one from the buffer
when passing it into readlink().
Signed-off-by: Rob Bradford <rob@linux.intel.com>
libbacklight is 300 lines of code in one .c file, and we're relying on
udev changes that aren't yet upstream. For now, let's just keep a
copy in weston and if the Xorg DDX drivers start using libbacklight and
it becomes more widely available, we'll make it an external dependency.