From dd472c3e33f6b3408030d0183484c7a47f3e91bb Mon Sep 17 00:00:00 2001 From: Martin Stjernholm <mast@lysator.liu.se> Date: Mon, 26 Jun 2000 15:52:36 +0200 Subject: [PATCH] Fixed fencepost bug in / stripping code for NT. Rev: src/fdlib.c:1.33 --- src/fdlib.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/fdlib.c b/src/fdlib.c index 5d193fc9cb..debf5cb167 100644 --- a/src/fdlib.c +++ b/src/fdlib.c @@ -3,7 +3,7 @@ #include "error.h" #include <math.h> -RCSID("$Id: fdlib.c,v 1.32 2000/06/17 02:20:58 hubbe Exp $"); +RCSID("$Id: fdlib.c,v 1.33 2000/06/26 13:52:36 mast Exp $"); #ifdef HAVE_WINSOCK_H @@ -96,7 +96,9 @@ int debug_fd_stat(char *file, struct stat *buf) char fname[MAX_PATH]; if(file[l-1]=='/' || file[l-1]=='\\') { - while(l && ( file[l]=='/' || file[l]=='\\' )) l--; + do l--; + while(l && ( file[l]=='/' || file[l]=='\\' )); + l++; if(l+1 > sizeof(fname)) { errno=EINVAL; @@ -119,7 +121,9 @@ FD debug_fd_open(char *file, int open_mode, int create_mode) char fname[MAX_PATH]; if(file[l-1]=='/' || file[l-1]=='\\') { - while(l && ( file[l]=='/' || file[l]=='\\' )) l--; + do l--; + while(l && ( file[l]=='/' || file[l]=='\\' )); + l++; if(l+1 > sizeof(fname)) { errno=EINVAL; -- GitLab