diff options
author | Ben Pfaff <blp@nicira.com> | 2013-01-24 13:19:52 -0800 |
---|---|---|
committer | Ben Pfaff <blp@nicira.com> | 2013-02-01 14:26:59 -0800 |
commit | e93af6a4790492e4eaf6ac4624fda6fcff26f209 (patch) | |
tree | bb7f6a71e1a6ee24a416de95b21fc4a86ba18df6 /lib/process.c | |
parent | 0d7bb1b4f4982637b316e51a258e8efaabb3e431 (diff) | |
download | openvswitch-e93af6a4790492e4eaf6ac4624fda6fcff26f209.tar.gz |
process: Check return value of set_nonblocking().
It's unlikely to fail but checking it can't hurt.
Found by Coverity.
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
Diffstat (limited to 'lib/process.c')
-rw-r--r-- | lib/process.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/lib/process.c b/lib/process.c index 3fc2e1827..795a136d7 100644 --- a/lib/process.c +++ b/lib/process.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2009, 2010, 2011, 2012 Nicira, Inc. + * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013 Nicira, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -408,14 +408,20 @@ struct stream { static int stream_open(struct stream *s, size_t max_size) { + int error; + s->max_size = max_size; ds_init(&s->log); if (pipe(s->fds)) { VLOG_WARN("failed to create pipe: %s", strerror(errno)); return errno; } - set_nonblocking(s->fds[0]); - return 0; + error = set_nonblocking(s->fds[0]); + if (error) { + close(s->fds[0]); + close(s->fds[1]); + } + return error; } static void |