ls.c (102644) | ls.c (120945) |
---|---|
1/* 2 * Copyright (c) 1999 - 2002 Kungliga Tekniska H�gskolan 3 * (Royal Institute of Technology, Stockholm, Sweden). 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 19 unchanged lines hidden (view full) --- 28 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 29 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 30 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 31 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ 32 33#ifndef TEST 34#include "ftpd_locl.h" 35 | 1/* 2 * Copyright (c) 1999 - 2002 Kungliga Tekniska H�gskolan 3 * (Royal Institute of Technology, Stockholm, Sweden). 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 19 unchanged lines hidden (view full) --- 28 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 29 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 30 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 31 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ 32 33#ifndef TEST 34#include "ftpd_locl.h" 35 |
36RCSID("$Id: ls.c,v 1.25 2002/08/22 08:31:03 joda Exp $"); | 36RCSID("$Id: ls.c,v 1.26 2003/02/25 10:51:30 lha Exp $"); |
37 38#else 39#include <stdio.h> 40#include <string.h> 41#include <stdlib.h> 42#include <time.h> 43#include <dirent.h> 44#include <sys/stat.h> --- 218 unchanged lines hidden (view full) --- 263 p = filename; 264 if((flags & LS_TYPE) && file_type != 0) 265 asprintf(&file->filename, "%s%c", p, file_type); 266 else 267 file->filename = strdup(p); 268 } 269 if(S_ISLNK(st->st_mode)) { 270 int n; | 37 38#else 39#include <stdio.h> 40#include <string.h> 41#include <stdlib.h> 42#include <time.h> 43#include <dirent.h> 44#include <sys/stat.h> --- 218 unchanged lines hidden (view full) --- 263 p = filename; 264 if((flags & LS_TYPE) && file_type != 0) 265 asprintf(&file->filename, "%s%c", p, file_type); 266 else 267 file->filename = strdup(p); 268 } 269 if(S_ISLNK(st->st_mode)) { 270 int n; |
271 n = readlink((char *)filename, buf, sizeof(buf)); | 271 n = readlink((char *)filename, buf, sizeof(buf) - 1); |
272 if(n >= 0) { 273 buf[n] = '\0'; 274 file->link = strdup(buf); 275 } else 276 sec_fprintf2(out, "readlink(%s): %s", filename, strerror(errno)); 277 } 278} 279 --- 575 unchanged lines hidden --- | 272 if(n >= 0) { 273 buf[n] = '\0'; 274 file->link = strdup(buf); 275 } else 276 sec_fprintf2(out, "readlink(%s): %s", filename, strerror(errno)); 277 } 278} 279 --- 575 unchanged lines hidden --- |