Skip to content

Commit

Permalink
Add a few more users for ovs_retval_to_string().
Browse files Browse the repository at this point in the history
  • Loading branch information
blp committed Apr 4, 2011
1 parent 1c5a216 commit fe1e967
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 14 deletions.
3 changes: 1 addition & 2 deletions lib/entropy.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,7 @@ get_entropy(void *buffer, size_t n)
close(fd);

if (error) {
VLOG_ERR("%s: read error (%s)", urandom,
error == EOF ? "unexpected end of file" : strerror(error));
VLOG_ERR("%s: read error (%s)", urandom, ovs_retval_to_string(error));
}
return error;
}
Expand Down
10 changes: 2 additions & 8 deletions lib/ovsdb-error.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 *
ovsdb_error_to_json(const struct ovsdb_error *error)
{
Expand All @@ -211,7 +205,7 @@ ovsdb_error_to_json(const struct ovsdb_error *error)
}
if (error->errno_) {
json_object_put_string(json, "io-error",
ovsdb_errno_string(error->errno_));
ovs_retval_to_string(error->errno_));
}
return json;
}
Expand All @@ -228,7 +222,7 @@ ovsdb_error_to_string(const struct ovsdb_error *error)
ds_put_format(&ds, ": %s", error->details);
}
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);
}
Expand Down
5 changes: 2 additions & 3 deletions lib/unixctl.c
Original file line number Diff line number Diff line change
@@ -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");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -568,8 +568,7 @@ unixctl_client_transact(struct unixctl_client *client,
if (error) {
VLOG_WARN("error reading reply from %s: %s",
client->connect_path,
(error == EOF ? "unexpected end of file"
: strerror(error)));
ovs_retval_to_string(error));
goto error;
}

Expand Down
2 changes: 1 addition & 1 deletion tests/ovsdb-log.at
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ AT_CHECK(
[[file: open successful
file: read: [0]
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
]], [ignore])
AT_CHECK(
Expand Down

0 comments on commit fe1e967

Please sign in to comment.