diff options
author | Yongqin Liu <yongqin.liu@linaro.org> | 2015-09-10 22:05:44 +0800 |
---|---|---|
committer | Yongqin Liu <yongqin.liu@linaro.org> | 2015-09-10 22:05:44 +0800 |
commit | 3ac7fa871a4b66c444cd574bcd113fb32eb937d9 (patch) | |
tree | de03d04d2f08aea210f676ec7765d5dd2e6d27c4 | |
parent | c3fcd2a942b87c081a2401ec32733964ddbe395f (diff) | |
download | linaro-android-kernel-test-3ac7fa871a4b66c444cd574bcd113fb32eb937d9.tar.gz |
vfat-volid: fix the call of ioctl on VFAT_IOCTL_GET_VOLUME_ID with 3.18 kernel
In kernel 3.18, VFAT_IOCTL_GET_VOLUME_ID is defined as 0x13,
and the valued is set to the variable passed to ioctl call instead of the return value
Change-Id: I0c9a57145bba60ec73e188c412dd5a477bc41045
Signed-off-by: Yongqin Liu <yongqin.liu@linaro.org>
-rw-r--r-- | vfat-volid/test.sh | 2 | ||||
-rw-r--r-- | vfat-volid/vfat-volid.c | 8 |
2 files changed, 4 insertions, 6 deletions
diff --git a/vfat-volid/test.sh b/vfat-volid/test.sh index 67b115b..2f545ad 100644 --- a/vfat-volid/test.sh +++ b/vfat-volid/test.sh @@ -57,7 +57,7 @@ function do_test() { step=6 echo "Getting volume ID" | tee -a $LOG - v1=`/system/bin/vfat-volid --path $MPT -i` + v1=`/system/bin/vfat-volid --path $MPT` rc=$? if [ $rc -ne 0 ]; then echo "Error when getting volume ID" | tee -a $LOG diff --git a/vfat-volid/vfat-volid.c b/vfat-volid/vfat-volid.c index 631438f..0279355 100644 --- a/vfat-volid/vfat-volid.c +++ b/vfat-volid/vfat-volid.c @@ -19,7 +19,7 @@ #ifndef VFAT_IOCTL_GET_VOLUME_ID #warning The IOCTL code has not been defined in public headers... -#define VFAT_IOCTL_GET_VOLUME_ID _IOR('r', 0x12, __u32) +#define VFAT_IOCTL_GET_VOLUME_ID _IOR('r', 0x13, __u32) #endif int main(int argc, char *argv[]) @@ -68,10 +68,8 @@ int main(int argc, char *argv[]) return -h; } - res = ioctl(h, VFAT_IOCTL_GET_VOLUME_ID); - id = res; - - if (res < 0 && !ignore_ioctl_error) { + res = ioctl(h, VFAT_IOCTL_GET_VOLUME_ID, &id); + if (res != 0 && !ignore_ioctl_error) { perror("Error on ioctl"); free(device); return -res; |