diff options
author | sr | 2012-08-25 16:14:20 +0200 |
---|---|---|
committer | sr | 2012-08-25 16:14:20 +0200 |
commit | 965c7ff9a9d64bb53dd7a808f3193b36ab7b014d (patch) | |
tree | 242cc32bf8f8dace2195a91ab286af970fc0d7a5 /src/client | |
parent | ... (diff) | |
download | dnbd3-965c7ff9a9d64bb53dd7a808f3193b36ab7b014d.tar.gz dnbd3-965c7ff9a9d64bb53dd7a808f3193b36ab7b014d.tar.xz dnbd3-965c7ff9a9d64bb53dd7a808f3193b36ab7b014d.zip |
[*] Fix bug in serializer_get_*
[CLIENT/KERNEL] Change ioctl to handle volume names instead if vids
[*] Make protocol endian safe
[CLIENT] Display ioctl errorcode on failure
Diffstat (limited to 'src/client')
-rw-r--r-- | src/client/client.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/src/client/client.c b/src/client/client.c index a48cab9..86b7cb9 100644 --- a/src/client/client.c +++ b/src/client/client.c @@ -123,7 +123,7 @@ int main(int argc, char *argv[]) break; case 'h': dnbd3_get_ip(optarg, msg.addr, &msg.addrtype); - printf("Host set to %s (type %d)\n", optarg, (int)msg.addrtype); + printf("Host set to %s (type %d)\n", inet_ntoa(*(struct in_addr*)msg.addr), (int)msg.addrtype); break; case 'i': msg.imgname = strdup(optarg); @@ -166,9 +166,10 @@ int main(int argc, char *argv[]) fd = open(dev, O_WRONLY); printf("INFO: Closing device %s\n", dev); - if (ioctl(fd, IOCTL_CLOSE, &msg) < 0) + const int ret = ioctl(fd, IOCTL_OPEN, &msg); + if (ret < 0) { - printf("ERROR: ioctl not successful (close)\n"); + printf("ERROR: ioctl not successful (close, errcode: %d)\n", ret); exit(EXIT_FAILURE); } @@ -199,9 +200,10 @@ int main(int argc, char *argv[]) fd = open(dev, O_WRONLY); printf("INFO: Connecting %s to %s (%s rid:%i)\n", dev, "<fixme>", msg.imgname, msg.rid); - if (ioctl(fd, IOCTL_OPEN, &msg) < 0) + const int ret = ioctl(fd, IOCTL_OPEN, &msg); + if (ret < 0) { - printf("ERROR: ioctl not successful (connect)\n"); + printf("ERROR: ioctl not successful (connect, errcode: %d)\n", ret); exit(EXIT_FAILURE); } @@ -235,9 +237,10 @@ int main(int argc, char *argv[]) fd = open(dev, O_WRONLY); printf("INFO: Connecting %s to %s (%s rid:%i)\n", dev, "<fixme>", msg.imgname, msg.rid); - if (ioctl(fd, IOCTL_OPEN, &msg) < 0) + const int ret = ioctl(fd, IOCTL_OPEN, &msg); + if (ret < 0) { - printf("ERROR: ioctl not successful (connect)\n"); + printf("ERROR: ioctl not successful (config file, errcode: %d)\n", ret); exit(EXIT_FAILURE); } |