diff options
author | Markus Armbruster <armbru@redhat.com> | 2010-02-18 17:25:24 +0100 |
---|---|---|
committer | Markus Armbruster <armbru@redhat.com> | 2010-03-16 16:58:32 +0100 |
commit | 1ecda02b24a13f501e747b8442934829d82698ae (patch) | |
tree | 8989913831ca3e48220b57f9104978015e39c5cb /net | |
parent | 6fdb03d58c614e0097d80ed130c19dcc393f7421 (diff) | |
download | qemu-1ecda02b24a13f501e747b8442934829d82698ae.zip qemu-1ecda02b24a13f501e747b8442934829d82698ae.tar.gz qemu-1ecda02b24a13f501e747b8442934829d82698ae.tar.bz2 |
error: Replace qemu_error() by error_report()
error_report() terminates the message with a newline. Strip it it
from its arguments.
This fixes a few error messages lacking a newline:
net_handle_fd_param()'s "No file descriptor named %s found", and
tap_open()'s "vnet_hdr=1 requested, but no kernel support for
IFF_VNET_HDR available" (all three versions).
There's one place that passes arguments without newlines
intentionally: load_vmstate(). Fix it up.
Diffstat (limited to 'net')
-rw-r--r-- | net/dump.c | 4 | ||||
-rw-r--r-- | net/slirp.c | 28 | ||||
-rw-r--r-- | net/socket.c | 10 | ||||
-rw-r--r-- | net/tap-bsd.c | 7 | ||||
-rw-r--r-- | net/tap-linux.c | 8 | ||||
-rw-r--r-- | net/tap-solaris.c | 4 | ||||
-rw-r--r-- | net/tap-win32.c | 2 | ||||
-rw-r--r-- | net/tap.c | 2 |
8 files changed, 33 insertions, 32 deletions
@@ -108,7 +108,7 @@ static int net_dump_init(VLANState *vlan, const char *device, fd = open(filename, O_CREAT | O_WRONLY | O_BINARY, 0644); if (fd < 0) { - qemu_error("-net dump: can't open %s\n", filename); + error_report("-net dump: can't open %s", filename); return -1; } @@ -121,7 +121,7 @@ static int net_dump_init(VLANState *vlan, const char *device, hdr.linktype = 1; if (write(fd, &hdr, sizeof(hdr)) < sizeof(hdr)) { - qemu_error("-net dump write error: %s\n", strerror(errno)); + error_report("-net dump write error: %s", strerror(errno)); close(fd); return -1; } diff --git a/net/slirp.c b/net/slirp.c index 7f846ec..b41c60a 100644 --- a/net/slirp.c +++ b/net/slirp.c @@ -413,14 +413,14 @@ static int slirp_hostfwd(SlirpState *s, const char *redir_str, if (slirp_add_hostfwd(s->slirp, is_udp, host_addr, host_port, guest_addr, guest_port) < 0) { - qemu_error("could not set up host forwarding rule '%s'\n", - redir_str); + error_report("could not set up host forwarding rule '%s'", + redir_str); return -1; } return 0; fail_syntax: - qemu_error("invalid host forwarding rule '%s'\n", redir_str); + error_report("invalid host forwarding rule '%s'", redir_str); return -1; } @@ -473,10 +473,10 @@ static void slirp_smb_cleanup(SlirpState *s) snprintf(cmd, sizeof(cmd), "rm -rf %s", s->smb_dir); ret = system(cmd); if (ret == -1 || !WIFEXITED(ret)) { - qemu_error("'%s' failed.\n", cmd); + error_report("'%s' failed.", cmd); } else if (WEXITSTATUS(ret)) { - qemu_error("'%s' failed. Error code: %d\n", - cmd, WEXITSTATUS(ret)); + error_report("'%s' failed. Error code: %d", + cmd, WEXITSTATUS(ret)); } s->smb_dir[0] = '\0'; } @@ -493,7 +493,7 @@ static int slirp_smb(SlirpState* s, const char *exported_dir, snprintf(s->smb_dir, sizeof(s->smb_dir), "/tmp/qemu-smb.%ld-%d", (long)getpid(), instance++); if (mkdir(s->smb_dir, 0700) < 0) { - qemu_error("could not create samba server dir '%s'\n", s->smb_dir); + error_report("could not create samba server dir '%s'", s->smb_dir); return -1; } snprintf(smb_conf, sizeof(smb_conf), "%s/%s", s->smb_dir, "smb.conf"); @@ -501,8 +501,8 @@ static int slirp_smb(SlirpState* s, const char *exported_dir, f = fopen(smb_conf, "w"); if (!f) { slirp_smb_cleanup(s); - qemu_error("could not create samba server configuration file '%s'\n", - smb_conf); + error_report("could not create samba server configuration file '%s'", + smb_conf); return -1; } fprintf(f, @@ -533,7 +533,7 @@ static int slirp_smb(SlirpState* s, const char *exported_dir, if (slirp_add_exec(s->slirp, 0, smb_cmdline, &vserver_addr, 139) < 0) { slirp_smb_cleanup(s); - qemu_error("conflicting/invalid smbserver address\n"); + error_report("conflicting/invalid smbserver address"); return -1; } return 0; @@ -618,14 +618,14 @@ static int slirp_guestfwd(SlirpState *s, const char *config_str, snprintf(buf, sizeof(buf), "guestfwd.tcp:%d", port); fwd->hd = qemu_chr_open(buf, p, NULL); if (!fwd->hd) { - qemu_error("could not open guest forwarding device '%s'\n", buf); + error_report("could not open guest forwarding device '%s'", buf); qemu_free(fwd); return -1; } if (slirp_add_exec(s->slirp, 3, fwd->hd, &server, port) < 0) { - qemu_error("conflicting/invalid host:port in guest forwarding " - "rule '%s'\n", config_str); + error_report("conflicting/invalid host:port in guest forwarding " + "rule '%s'", config_str); qemu_free(fwd); return -1; } @@ -638,7 +638,7 @@ static int slirp_guestfwd(SlirpState *s, const char *config_str, return 0; fail_syntax: - qemu_error("invalid guest forwarding rule '%s'\n", config_str); + error_report("invalid guest forwarding rule '%s'", config_str); return -1; } diff --git a/net/socket.c b/net/socket.c index 474d573..1c4e153 100644 --- a/net/socket.c +++ b/net/socket.c @@ -506,7 +506,7 @@ int net_init_socket(QemuOpts *opts, if (qemu_opt_get(opts, "listen") || qemu_opt_get(opts, "connect") || qemu_opt_get(opts, "mcast")) { - qemu_error("listen=, connect= and mcast= is invalid with fd=\n"); + error_report("listen=, connect= and mcast= is invalid with fd="); return -1; } @@ -525,7 +525,7 @@ int net_init_socket(QemuOpts *opts, if (qemu_opt_get(opts, "fd") || qemu_opt_get(opts, "connect") || qemu_opt_get(opts, "mcast")) { - qemu_error("fd=, connect= and mcast= is invalid with listen=\n"); + error_report("fd=, connect= and mcast= is invalid with listen="); return -1; } @@ -540,7 +540,7 @@ int net_init_socket(QemuOpts *opts, if (qemu_opt_get(opts, "fd") || qemu_opt_get(opts, "listen") || qemu_opt_get(opts, "mcast")) { - qemu_error("fd=, listen= and mcast= is invalid with connect=\n"); + error_report("fd=, listen= and mcast= is invalid with connect="); return -1; } @@ -555,7 +555,7 @@ int net_init_socket(QemuOpts *opts, if (qemu_opt_get(opts, "fd") || qemu_opt_get(opts, "connect") || qemu_opt_get(opts, "listen")) { - qemu_error("fd=, connect= and listen= is invalid with mcast=\n"); + error_report("fd=, connect= and listen= is invalid with mcast="); return -1; } @@ -565,7 +565,7 @@ int net_init_socket(QemuOpts *opts, return -1; } } else { - qemu_error("-socket requires fd=, listen=, connect= or mcast=\n"); + error_report("-socket requires fd=, listen=, connect= or mcast="); return -1; } diff --git a/net/tap-bsd.c b/net/tap-bsd.c index 815997d..e51d068 100644 --- a/net/tap-bsd.c +++ b/net/tap-bsd.c @@ -69,7 +69,8 @@ int tap_open(char *ifname, int ifname_size, int *vnet_hdr, int vnet_hdr_required } } if (fd < 0) { - qemu_error("warning: could not open %s (%s): no virtual network emulation\n", dname, strerror(errno)); + error_report("warning: could not open %s (%s): no virtual network emulation", + dname, strerror(errno)); return -1; } #else @@ -89,8 +90,8 @@ int tap_open(char *ifname, int ifname_size, int *vnet_hdr, int vnet_hdr_required *vnet_hdr = 0; if (vnet_hdr_required && !*vnet_hdr) { - qemu_error("vnet_hdr=1 requested, but no kernel " - "support for IFF_VNET_HDR available"); + error_report("vnet_hdr=1 requested, but no kernel " + "support for IFF_VNET_HDR available"); close(fd); return -1; } diff --git a/net/tap-linux.c b/net/tap-linux.c index c5748e6..03b8301 100644 --- a/net/tap-linux.c +++ b/net/tap-linux.c @@ -58,8 +58,8 @@ int tap_open(char *ifname, int ifname_size, int *vnet_hdr, int vnet_hdr_required } if (vnet_hdr_required && !*vnet_hdr) { - qemu_error("vnet_hdr=1 requested, but no kernel " - "support for IFF_VNET_HDR available"); + error_report("vnet_hdr=1 requested, but no kernel " + "support for IFF_VNET_HDR available"); close(fd); return -1; } @@ -97,7 +97,7 @@ int tap_set_sndbuf(int fd, QemuOpts *opts) } if (ioctl(fd, TUNSETSNDBUF, &sndbuf) == -1 && qemu_opt_get(opts, "sndbuf")) { - qemu_error("TUNSETSNDBUF ioctl failed: %s\n", strerror(errno)); + error_report("TUNSETSNDBUF ioctl failed: %s", strerror(errno)); return -1; } return 0; @@ -108,7 +108,7 @@ int tap_probe_vnet_hdr(int fd) struct ifreq ifr; if (ioctl(fd, TUNGETIFF, &ifr) != 0) { - qemu_error("TUNGETIFF ioctl() failed: %s\n", strerror(errno)); + error_report("TUNGETIFF ioctl() failed: %s", strerror(errno)); return 0; } diff --git a/net/tap-solaris.c b/net/tap-solaris.c index 0b42861..50d127a 100644 --- a/net/tap-solaris.c +++ b/net/tap-solaris.c @@ -186,8 +186,8 @@ int tap_open(char *ifname, int ifname_size, int *vnet_hdr, int vnet_hdr_required *vnet_hdr = 0; if (vnet_hdr_required && !*vnet_hdr) { - qemu_error("vnet_hdr=1 requested, but no kernel " - "support for IFF_VNET_HDR available"); + error_report("vnet_hdr=1 requested, but no kernel " + "support for IFF_VNET_HDR available"); close(fd); return -1; } diff --git a/net/tap-win32.c b/net/tap-win32.c index 8370c80..a5c2ce9 100644 --- a/net/tap-win32.c +++ b/net/tap-win32.c @@ -706,7 +706,7 @@ int net_init_tap(QemuOpts *opts, Monitor *mon, const char *name, VLANState *vlan ifname = qemu_opt_get(opts, "ifname"); if (!ifname) { - qemu_error("tap: no interface name\n"); + error_report("tap: no interface name"); return -1; } @@ -394,7 +394,7 @@ int net_init_tap(QemuOpts *opts, Monitor *mon, const char *name, VLANState *vlan qemu_opt_get(opts, "script") || qemu_opt_get(opts, "downscript") || qemu_opt_get(opts, "vnet_hdr")) { - qemu_error("ifname=, script=, downscript= and vnet_hdr= is invalid with fd=\n"); + error_report("ifname=, script=, downscript= and vnet_hdr= is invalid with fd="); return -1; } |