Merge "Patch ifconfig from toolbox"
diff --git a/ioctl.c b/ioctl.c
index be0bbd4..c765287 100644
--- a/ioctl.c
+++ b/ioctl.c
@@ -86,12 +86,23 @@
ioctl_argp_save = ioctl_argp = ioctl_args;
rem = length;
while(optind < argc) {
- uint64_t tmp = strtoull(argv[optind], NULL, 0);
+ uint64_t tmp_64 = strtoull(argv[optind], NULL, 0);
+ uint32_t tmp_32 = tmp_64;
if(rem < arg_size) {
fprintf(stderr, "%s: too many arguments\n", argv[0]);
exit(1);
}
- memcpy(ioctl_argp, &tmp, arg_size);
+ switch (arg_size) {
+ case sizeof(tmp_64):
+ memcpy(ioctl_argp, &tmp_64, sizeof(tmp_64));
+ break;
+ case sizeof(tmp_32):
+ memcpy(ioctl_argp, &tmp_32, sizeof(tmp_32));
+ break;
+ default:
+ fprintf(stderr, "%s: unhandled arg_size\n", argv[0]);
+ exit(1);
+ }
ioctl_argp += arg_size;
rem -= arg_size;
optind++;