提交 3db3acb9 编写于 作者: J Jim Meyering

storage_backend.c: avoid closing a negative file descriptor

* src/storage/storage_backend.c (virStorageBackendRunProgRegex):
Don't close a negative (read-only) file descriptor.
上级 9344e6ad
/* /*
* storage_backend.c: internal storage driver backend contract * storage_backend.c: internal storage driver backend contract
* *
* Copyright (C) 2007-2009 Red Hat, Inc. * Copyright (C) 2007-2010 Red Hat, Inc.
* Copyright (C) 2007-2008 Daniel P. Berrange * Copyright (C) 2007-2008 Daniel P. Berrange
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
...@@ -1326,8 +1326,10 @@ virStorageBackendRunProgRegex(virConnectPtr conn, ...@@ -1326,8 +1326,10 @@ virStorageBackendRunProgRegex(virConnectPtr conn,
if (list) if (list)
fclose(list); fclose(list);
else else {
close(fd); if (fd >= 0)
close(fd);
}
while ((err = waitpid(child, &exitstatus, 0) == -1) && errno == EINTR); while ((err = waitpid(child, &exitstatus, 0) == -1) && errno == EINTR);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册