[node-patches] Change in ovirt-node[master]: ovirtfunctions: Prevent recursion in safe_delete

danken at redhat.com danken at redhat.com
Mon May 19 14:32:13 UTC 2014


Dan Kenigsberg has posted comments on this change.

Change subject: ovirtfunctions: Prevent recursion in safe_delete
......................................................................


Patch Set 3: Code-Review-1

(1 comment)

http://gerrit.ovirt.org/#/c/27476/3/src/ovirtnode/ovirtfunctions.py
File src/ovirtnode/ovirtfunctions.py:

Line 1090:         if os.path.isdir(filename):
Line 1091:             ls_cmd = subprocess_closefds("ls -d '%s'" % filename, shell=True, stdout=PIPE, stderr=STDOUT)
Line 1092:             output, err = ls_cmd.communicate()
Line 1093:             for child in output:
Line 1094:                 is_same = os.path.realpath(filename) == os.path.realpath(child)
there's no need for the extra "is_same" check: if the child is "the same" as the parent, it can only be that it's a softlink to the parent.
Line 1095:                 is_link = os.path.islink(child)
Line 1096:                 if is_same or is_link:
Line 1097:                     # Child == Parent OR symlink - Don't recurse
Line 1098:                     pass


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

Gerrit-MessageType: comment
Gerrit-Change-Id: Ic2e89492f4c18c1afd41e399e854fc9be4f091eb
Gerrit-PatchSet: 3
Gerrit-Project: ovirt-node
Gerrit-Branch: master
Gerrit-Owner: Fabian Deutsch <fabiand at fedoraproject.org>
Gerrit-Reviewer: Dan Kenigsberg <danken at redhat.com>
Gerrit-Reviewer: Douglas Schilling Landgraf <dougsland at redhat.com>
Gerrit-Reviewer: automation at ovirt.org
Gerrit-Reviewer: oVirt Jenkins CI Server
Gerrit-HasComments: Yes



More information about the node-patches mailing list