2
0
mirror of https://github.com/openvswitch/ovs synced 2025-09-03 07:45:30 +00:00

Add a few more users for ovs_retval_to_string().

This commit is contained in:
Ben Pfaff
2011-03-31 14:50:20 -07:00
parent 1c5a216a80
commit fe1e967e3b
4 changed files with 6 additions and 14 deletions

View File

@@ -47,8 +47,7 @@ get_entropy(void *buffer, size_t n)
close(fd); close(fd);
if (error) { if (error) {
VLOG_ERR("%s: read error (%s)", urandom, VLOG_ERR("%s: read error (%s)", urandom, ovs_retval_to_string(error));
error == EOF ? "unexpected end of file" : strerror(error));
} }
return error; return error;
} }

View File

@@ -192,12 +192,6 @@ ovsdb_error_clone(const struct ovsdb_error *old)
} }
} }
static const char *
ovsdb_errno_string(int error)
{
return error == EOF ? "unexpected end of file" : strerror(error);
}
struct json * struct json *
ovsdb_error_to_json(const struct ovsdb_error *error) ovsdb_error_to_json(const struct ovsdb_error *error)
{ {
@@ -211,7 +205,7 @@ ovsdb_error_to_json(const struct ovsdb_error *error)
} }
if (error->errno_) { if (error->errno_) {
json_object_put_string(json, "io-error", json_object_put_string(json, "io-error",
ovsdb_errno_string(error->errno_)); ovs_retval_to_string(error->errno_));
} }
return json; return json;
} }
@@ -228,7 +222,7 @@ ovsdb_error_to_string(const struct ovsdb_error *error)
ds_put_format(&ds, ": %s", error->details); ds_put_format(&ds, ": %s", error->details);
} }
if (error->errno_) { if (error->errno_) {
ds_put_format(&ds, " (%s)", ovsdb_errno_string(error->errno_)); ds_put_format(&ds, " (%s)", ovs_retval_to_string(error->errno_));
} }
return ds_steal_cstr(&ds); return ds_steal_cstr(&ds);
} }

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2008, 2009, 2010 Nicira Networks. * Copyright (c) 2008, 2009, 2010, 2011 Nicira Networks.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -568,8 +568,7 @@ unixctl_client_transact(struct unixctl_client *client,
if (error) { if (error) {
VLOG_WARN("error reading reply from %s: %s", VLOG_WARN("error reading reply from %s: %s",
client->connect_path, client->connect_path,
(error == EOF ? "unexpected end of file" ovs_retval_to_string(error));
: strerror(error)));
goto error; goto error;
} }

View File

@@ -235,7 +235,7 @@ AT_CHECK(
[[file: open successful [[file: open successful
file: read: [0] file: read: [0]
file: read: [1] file: read: [1]
file: read failed: I/O error: file: error reading 4 bytes starting at offset 170 (unexpected end of file) file: read failed: I/O error: file: error reading 4 bytes starting at offset 170 (End of file)
file: write:["longer data"] successful file: write:["longer data"] successful
]], [ignore]) ]], [ignore])
AT_CHECK( AT_CHECK(