Skip to content

Commit

Permalink
i lost who sent this to me (sorry). patches to fix AIX.
Browse files Browse the repository at this point in the history
  • Loading branch information
Robey Pointer committed Apr 25, 2010
1 parent f67cea4 commit 3242df7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
3 changes: 2 additions & 1 deletion paramiko/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,8 @@ def connect(self, hostname, port=SSH_PORT, username=None, password=None, pkey=No
addr = sockaddr
break
else:
raise SSHException('No suitable address family for %s' % hostname)
# some OS like AIX don't indicate SOCK_STREAM support, so just guess. :(
af, _, _, _, addr = socket.getaddrinfo(hostname, port, socket.AF_UNSPEC, socket.SOCK_STREAM)
sock = socket.socket(af, socket.SOCK_STREAM)
if timeout is not None:
try:
Expand Down
10 changes: 5 additions & 5 deletions paramiko/sftp_attr.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class SFTPAttributes (object):
are stored in a dict named C{attr}. Occasionally, the filename is also
stored, in C{filename}.
"""

FLAG_SIZE = 1
FLAG_UIDGID = 2
FLAG_PERMISSIONS = 4
Expand Down Expand Up @@ -89,7 +89,7 @@ def __repr__(self):

### internals...


def _from_msg(cls, msg, filename=None, longname=None):
attr = cls()
attr._unpack(msg)
Expand Down Expand Up @@ -200,7 +200,7 @@ def __str__(self):
else:
ks = '?---------'
# compute display date
if (self.st_mtime is None) or (self.st_mtime == 0xffffffff):
if (self.st_mtime is None) or (self.st_mtime == 0xffffffffL):
# shouldn't really happen
datestr = '(unknown date)'
else:
Expand All @@ -210,14 +210,14 @@ def __str__(self):
else:
datestr = time.strftime('%d %b %H:%M', time.localtime(self.st_mtime))
filename = getattr(self, 'filename', '?')

# not all servers support uid/gid
uid = self.st_uid
gid = self.st_gid
if uid is None:
uid = 0
if gid is None:
gid = 0

return '%s 1 %-8d %-8d %8d %-12s %s' % (ks, uid, gid, self.st_size, datestr, filename)

0 comments on commit 3242df7

Please sign in to comment.