Prevented a surplus slash in compare_file paths

This commit is contained in:
Thomas Schmitt 2024-09-25 09:52:12 +02:00
parent 36a3cbdec0
commit 10efc4aade

View File

@ -5,7 +5,7 @@
To compare tree /media/dvd and /original/dir : To compare tree /media/dvd and /original/dir :
find /media/dvd -exec compare_file '{}' /media/dvd /original/dir ';' find /media/dvd -exec compare_file '{}' /media/dvd /original/dir ';'
Copyright 2008 - 2015 Thomas Schmitt, <scdbackup@gmx.net> Copyright 2008 - 2024 Thomas Schmitt, <scdbackup@gmx.net>
Provided under GPL version 2 or later. Provided under GPL version 2 or later.
@ -304,7 +304,8 @@ int main(int argc, char **argv)
strcpy(adr1, argv[1]); strcpy(adr1, argv[1]);
strcpy(adrc, argv[1]+strlen(argv[2])); strcpy(adrc, argv[1]+strlen(argv[2]));
strcpy(adr2, argv[3]); strcpy(adr2, argv[3]);
if(adrc[0] == '/' || adrc[0] == 0) if(!(adrc[0] == '/' || adrc[0] == 0 ||
(strlen(adr2) > 0 && adr2[strlen(adr2) - 1] == '/')))
strcat(adr2, "/"); strcat(adr2, "/");
strcat(adr2, adrc); strcat(adr2, adrc);