fix file open mode

This commit is contained in:
Mike McLean 2019-03-02 15:58:49 -05:00
parent 3b86d7f247
commit 01b0a41639
3 changed files with 4 additions and 4 deletions

View file

@ -461,7 +461,7 @@ class BuildRoot(object):
self.logger.info('Rereading %s, inode: %s -> %s, size: %s -> %s' %
(fpath, inode, stat_info.st_ino, size, stat_info.st_size))
fd.close()
fd = open(fpath, 'r')
fd = open(fpath, 'rb')
logs[fname] = (fd, stat_info.st_ino, stat_info.st_size or size, fpath)
except:
self.logger.error("Error reading mock log: %s", fpath)

View file

@ -881,7 +881,7 @@ def get_rpm_header(f, ts=None):
ts = rpm.TransactionSet()
ts.setVSFlags(rpm._RPMVSF_NOSIGNATURES|rpm._RPMVSF_NODIGESTS)
if isinstance(f, six.string_types):
fo = open(f, "r")
fo = open(f, "rb")
else:
fo = f
hdr = ts.hdrFromFdno(fo.fileno())
@ -2763,7 +2763,7 @@ class ClientSession(object):
start = time.time()
# XXX - stick in a config or something
retries = 3
fo = open(localfile, "r") #specify bufsize?
fo = open(localfile, "rb") #specify bufsize?
totalsize = os.path.getsize(localfile)
ofs = 0
md5sum = util.md5_constructor()

View file

@ -153,7 +153,7 @@ def log_output(session, path, args, outfile, uploadpath, cwd=None, logerror=0, a
if not outfd:
try:
outfd = open(outfile, 'r')
outfd = open(outfile, 'rb')
except IOError:
# will happen if the forked process has not created the logfile yet
continue