Tue Nov 8 18:02:27 2011 UTC ()
More help for stupid glibc headers.


(joerg)
diff -r1.39 -r1.40 pkgsrc/net/libfetch/files/ftp.c

cvs diff -r1.39 -r1.40 pkgsrc/net/libfetch/files/ftp.c (expand / switch to unified diff)

--- pkgsrc/net/libfetch/files/ftp.c 2011/10/02 19:15:34 1.39
+++ pkgsrc/net/libfetch/files/ftp.c 2011/11/08 18:02:27 1.40
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: ftp.c,v 1.39 2011/10/02 19:15:34 marino Exp $ */ 1/* $NetBSD: ftp.c,v 1.40 2011/11/08 18:02:27 joerg Exp $ */
2/*- 2/*-
3 * Copyright (c) 1998-2004 Dag-Erling Coïdan Smørgrav 3 * Copyright (c) 1998-2004 Dag-Erling Coïdan Smørgrav
4 * Copyright (c) 2008, 2009, 2010 Joerg Sonnenberger <joerg@NetBSD.org> 4 * Copyright (c) 2008, 2009, 2010 Joerg Sonnenberger <joerg@NetBSD.org>
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer 11 * notice, this list of conditions and the following disclaimer
12 * in this position and unchanged. 12 * in this position and unchanged.
13 * 2. Redistributions in binary form must reproduce the above copyright 13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the 14 * notice, this list of conditions and the following disclaimer in the
@@ -315,27 +315,28 @@ ftp_cwd(conn_t *conn, const char *path,  @@ -315,27 +315,28 @@ ftp_cwd(conn_t *conn, const char *path,
315 } 315 }
316 if (conn->ftp_home == NULL && (conn->ftp_home = strdup(pwd)) == NULL) { 316 if (conn->ftp_home == NULL && (conn->ftp_home = strdup(pwd)) == NULL) {
317 fetch_syserr(); 317 fetch_syserr();
318 free(pwd); 318 free(pwd);
319 return (-1); 319 return (-1);
320 } 320 }
321 if (*path == '/') { 321 if (*path == '/') {
322 while (path[1] == '/') 322 while (path[1] == '/')
323 ++path; 323 ++path;
324 dst = strdup(path); 324 dst = strdup(path);
325 } else if (strcmp(conn->ftp_home, "/") == 0) { 325 } else if (strcmp(conn->ftp_home, "/") == 0) {
326 dst = strdup(path - 1); 326 dst = strdup(path - 1);
327 } else { 327 } else {
328 asprintf(&dst, "%s/%s", conn->ftp_home, path); 328 if (asprintf(&dst, "%s/%s", conn->ftp_home, path) == -1)
 329 dst = NULL;
329 } 330 }
330 if (dst == NULL) { 331 if (dst == NULL) {
331 fetch_syserr(); 332 fetch_syserr();
332 free(pwd); 333 free(pwd);
333 return (-1); 334 return (-1);
334 } 335 }
335 336
336 if (subdir) 337 if (subdir)
337 end = dst + strlen(dst); 338 end = dst + strlen(dst);
338 else 339 else
339 end = strrchr(dst, '/'); 340 end = strrchr(dst, '/');
340 341
341 for (;;) { 342 for (;;) {