[PATCH v3 2/4] btrfs-progs: Use long type to get thread's return value

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



pthread use void * to save return status, we can use this pointer to
save our return value, but we need keep the same length.

This patch move to use long type variable to save return value
of our thread, to avoid potentia invalid memory access.

Signed-off-by: Zhao Lei <zhaolei@xxxxxxxxxxxxxx>
---
 chunk-recover.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/chunk-recover.c b/chunk-recover.c
index 66a4ce6..3cb22ae 100644
--- a/chunk-recover.c
+++ b/chunk-recover.c
@@ -829,7 +829,7 @@ static int scan_devices(struct recover_control *rc)
 	struct btrfs_device *dev;
 	struct device_scan *dev_scans;
 	pthread_t *t_scans;
-	int *t_rets;
+	long *t_rets;
 	int devnr = 0;
 	int devidx = 0;
 	int cancel_from = 0;
@@ -845,7 +845,7 @@ static int scan_devices(struct recover_control *rc)
 	t_scans = (pthread_t *)malloc(sizeof(pthread_t) * devnr);
 	if (!t_scans)
 		return -ENOMEM;
-	t_rets = (int *)malloc(sizeof(int) * devnr);
+	t_rets = (long *)malloc(sizeof(long) * devnr);
 	if (!t_rets)
 		return -ENOMEM;
 
-- 
1.8.5.1

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Filesystem Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux