Module Name: othersrc Committed By: stacktic Date: Tue Nov 17 15:27:39 UTC 2009
Modified Files: othersrc/bin/fsu_ecp: fsu_ecp.c Log Message: Fixed fsu_ecp when source is '/' To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 othersrc/bin/fsu_ecp/fsu_ecp.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: othersrc/bin/fsu_ecp/fsu_ecp.c diff -u othersrc/bin/fsu_ecp/fsu_ecp.c:1.10 othersrc/bin/fsu_ecp/fsu_ecp.c:1.11 --- othersrc/bin/fsu_ecp/fsu_ecp.c:1.10 Fri Nov 6 11:47:41 2009 +++ othersrc/bin/fsu_ecp/fsu_ecp.c Tue Nov 17 15:27:39 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: fsu_ecp.c,v 1.10 2009/11/06 11:47:41 stacktic Exp $ */ +/* $NetBSD: fsu_ecp.c,v 1.11 2009/11/17 15:27:39 stacktic Exp $ */ /* * Copyright (c) 2008 Arnaud Ysmal. All Rights Reserved. @@ -102,8 +102,8 @@ for (rv = 0, cur_arg = 0; cur_arg < argc-1; ++cur_arg) { len = strlen(argv[cur_arg]); - while (argv[cur_arg][--len] == '/') - argv[cur_arg][len] = '\0'; + while (len != 1 && argv[cur_arg][len - 1] == '/') + argv[cur_arg][--len] = '\0'; rv |= fsu_ecp(ukfs, argv[cur_arg], argv[argc-1], flags); } @@ -208,6 +208,8 @@ warn("%s", to); return -1; } + if (to_p[tlen - 1] != '/') + to_p[tlen++] = '/'; if (flags & FSU_ECP_GET) rv = lstat(to, &file_stat); @@ -221,13 +223,6 @@ else ++filename; - if (to_p[tlen - 1] == '/') - --tlen; - else if (to_p[tlen - 1] != '/' && filename[0] != '/') { - to_p[tlen] = '/'; - to_p[tlen + 1] = '\0'; - } - flen = strlen(filename); rv = strlcat(to_p, filename, PATH_MAX + 1); @@ -485,10 +480,7 @@ /* NOTREACHED */ } - if (rv != 0) - return -1; - - if (flags & FSU_ECP_GET) + if (rv != 0 || flags & FSU_ECP_GET) return rv; if (!(flags & FSU_ECP_NO_COPY_LINK)) @@ -578,7 +570,7 @@ struct stat file_stat; if (flags & FSU_ECP_VERBOSE) - printf("Copying fifo %s -> %s\n", from, to); + printf("%s -> %s\n", from, to); if (flags & FSU_ECP_GET) rv = lstat(to, &file_stat); @@ -676,7 +668,7 @@ target[rv] = '\0'; if (flags & FSU_ECP_VERBOSE) - printf("%s -> %s : %s", from, to, target); + printf("%s -> %s : %s\n", from, to, target); if (flags & FSU_ECP_GET) rv = lstat(to, &file_stat);