From d3fc2aa362fa8cfab0a7096864124b4c864966be Mon Sep 17 00:00:00 2001 From: dtucker Date: Thu, 21 Sep 2006 02:59:33 +0000 Subject: [PATCH] - otto@cvs.openbsd.org 2006/09/19 05:52:23 [sftp.c] Use S_IS* macros insted of masking with S_IF* flags. The latter may have multiple bits set, which lead to surprising results. Spotted by Paul Stoeber, more to come. ok millert@ pedro@ jaredy@ djm@ --- ChangeLog | 8 ++++++++ sftp.c | 6 +++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5aea0d00..139be43a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +20060921 + - (dtucker) OpenBSD CVS Sync + - otto@cvs.openbsd.org 2006/09/19 05:52:23 + [sftp.c] + Use S_IS* macros insted of masking with S_IF* flags. The latter may + have multiple bits set, which lead to surprising results. Spotted by + Paul Stoeber, more to come. ok millert@ pedro@ jaredy@ djm@ + 20060918 - (dtucker) [configure.ac] On AIX, check to see if the compiler will allow macro redefinitions, and if not, remove "-qlanglvl=ansi" from the flags. diff --git a/sftp.c b/sftp.c index cf3dea04..c018615a 100644 --- a/sftp.c +++ b/sftp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sftp.c,v 1.91 2006/08/03 03:34:42 deraadt Exp $ */ +/* $OpenBSD: sftp.c,v 1.92 2006/09/19 05:52:23 otto Exp $ */ /* * Copyright (c) 2001-2004 Damien Miller * @@ -493,7 +493,7 @@ is_dir(char *path) if (stat(path, &sb) == -1) return(0); - return(sb.st_mode & S_IFDIR); + return(S_ISDIR(sb.st_mode)); } static int @@ -517,7 +517,7 @@ remote_is_dir(struct sftp_conn *conn, char *path) return(0); if (!(a->flags & SSH2_FILEXFER_ATTR_PERMISSIONS)) return(0); - return(a->perm & S_IFDIR); + return(S_ISDIR(a->perm)); } static int -- 2.45.2