haptic: change return value check routine of open() 19/63719/1
authorTaeyoung Kim <ty317.kim@samsung.com>
Fri, 25 Mar 2016 09:20:37 +0000 (18:20 +0900)
committerTaeyoung Kim <ty317.kim@samsung.com>
Fri, 25 Mar 2016 09:20:37 +0000 (18:20 +0900)
- open() returns -1 when error is occurred. Thus
  *fd can have negative value. This is fixed
  by checking the value correctly

Change-Id: I2482b86612ca6b76fc799b87fdd82216d8b743d8
Signed-off-by: Taeyoung Kim <ty317.kim@samsung.com>
src/haptic/standard.c

index 251cc91..16d64f6 100644 (file)
@@ -121,7 +121,7 @@ static bool check_fd(int *fd)
                return true;
 
        ffd = open(ff_path, O_RDWR);
-       if (!ffd)
+       if (ffd <= 0)
                return false;
 
        *fd = ffd;