Change in vdsm[ovirt-3.3.0]: oop: improve safety for truncateFile

fsimonce at redhat.com fsimonce at redhat.com
Thu Oct 10 09:05:41 UTC 2013


Federico Simoncelli has submitted this change and it was merged.

Change subject: oop: improve safety for truncateFile
......................................................................


oop: improve safety for truncateFile

In order to make truncateFile safer and to avoid any confusion on its
behavior:

* a new comment has been added mentioning O_TRUNC and "w" to avoid any
  future mistake in this area
* a new test has been added to check the expected outcomes
* the "w" mode has been removed from truncateFile (used in os.fdopen)
  to prevent any future reconversion to open(path, "w")
* the risk of a file descriptor leak (for a failing os.fdopen call)
  has been removed using the relevant posix calls

Change-Id: Ib71b53498c7bc4ea7a1ab725feb18bc5929f8c85
Signed-off-by: Federico Simoncelli <fsimonce at redhat.com>
Reviewed-on: http://gerrit.ovirt.org/20046
Reviewed-by: Nir Soffer <nsoffer at redhat.com>
Reviewed-by: Sergey Gotliv <sgotliv at redhat.com>
Reviewed-by: Dan Kenigsberg <danken at redhat.com>
Reviewed-on: http://gerrit.ovirt.org/20063
---
M tests/remoteFileHandlerTests.py
M vdsm/storage/remoteFileHandler.py
2 files changed, 39 insertions(+), 3 deletions(-)

Approvals:
  Federico Simoncelli: Verified; Looks good to me, approved



-- 
To view, visit http://gerrit.ovirt.org/20063
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ib71b53498c7bc4ea7a1ab725feb18bc5929f8c85
Gerrit-PatchSet: 2
Gerrit-Project: vdsm
Gerrit-Branch: ovirt-3.3.0
Gerrit-Owner: Federico Simoncelli <fsimonce at redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken at redhat.com>
Gerrit-Reviewer: Federico Simoncelli <fsimonce at redhat.com>
Gerrit-Reviewer: Nir Soffer <nsoffer at redhat.com>
Gerrit-Reviewer: Sergey Gotliv <sgotliv at redhat.com>


More information about the vdsm-patches mailing list