[PATCH] Globs order fixed
Dima Kogan
dkogan at cds.caltech.edu
Fri Oct 10 07:36:28 EDT 2008
In the current version of cadaver (0.23.2) globs are expanded in
reverse order. So if my local directory has
1.jpg
2.jpg
3.jpg
and I do "mput *" in cadaver, the files will be uploaded in
reverse-numerical order. This is particularly annoying when using
cadaver to update a picture gallery; the pictures end up being stored
in reverse-chronological order. The problem stems from the globs being
expanded in the correct order, but being stored in reverse order. The
below patch fixes this. It looks like this code wasn't written by the
cadaver project, but came from elsewhere. Does anybody know where the
upstream for this code is, so that I can submit a patch there? Thanks!
--- a/lib/glob.c 2004-10-10 13:53:02.000000000 -0700
+++ b/lib/glob.c 2008-10-04 19:37:38.000000000 -0700
@@ -1241,6 +1241,7 @@
char *name;
};
struct globlink *names = NULL;
+ struct globlink *namesLast = NULL;
size_t nfound;
int meta;
int save;
@@ -1358,8 +1359,13 @@
memcpy ((__ptr_t) new->name, name, len);
new->name[len] = '\0';
#endif
- new->next = names;
- names = new;
+
+ new->next = NULL;
+ if(namesLast == NULL)
+ names = new;
+ else
+ namesLast->next = new;
+ namesLast = new;
++nfound;
}
}
More information about the cadaver
mailing list