diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2009-03-19 17:15:01 +0000 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2009-03-19 17:15:01 +0000 |
commit | ce1f26c5f10d4a1a2c4c0de789371fedf2d4c88d (patch) | |
tree | 49ca73607b531606dd92df98ea1f2e294401cfef | |
parent | 30d4d8eedf640ce1c8b9a4ba5bd583075a1beceb (diff) | |
download | gsc-ce1f26c5f10d4a1a2c4c0de789371fedf2d4c88d.tar.gz gsc-ce1f26c5f10d4a1a2c4c0de789371fedf2d4c88d.tar.bz2 |
Bugfix in sv_sync_www
* cvs/sv_sync_www.c (do_sync): Do not sort the array. This causes
malfunction on newly committed hierarchies.
git-svn-id: file:///svnroot/gsc/trunk@337 d2de0444-eb31-0410-8365-af798a554d48
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | cvs/sv_sync_www.c | 46 |
2 files changed, 9 insertions, 44 deletions
@@ -1,3 +1,10 @@ | |||
1 | 2009-03-19 Sergey Poznyakoff <gray@gnu.org.ua> | ||
2 | |||
3 | Bugfix in sv_sync_www | ||
4 | |||
5 | * cvs/sv_sync_www.c (do_sync): Do not sort the array. This causes | ||
6 | malfunction on newly committed hierarchies. | ||
7 | |||
1 | 2009-02-13 Sergey Poznyakoff <gray@gnu.org.ua> | 8 | 2009-02-13 Sergey Poznyakoff <gray@gnu.org.ua> |
2 | 9 | ||
3 | Bugfix | 10 | Bugfix |
diff --git a/cvs/sv_sync_www.c b/cvs/sv_sync_www.c index 7af1271..a251269 100644 --- a/cvs/sv_sync_www.c +++ b/cvs/sv_sync_www.c | |||
@@ -578,57 +578,15 @@ schedule_job (uid_t uid, gid_t gid, const char *file, | |||
578 | 578 | ||
579 | /* Multi-job support */ | 579 | /* Multi-job support */ |
580 | 580 | ||
581 | static int | ||
582 | dir_cmp (const char *a, const char *b) | ||
583 | { | ||
584 | if (!a) | ||
585 | { | ||
586 | if (b) | ||
587 | return -1; | ||
588 | else | ||
589 | return 0; | ||
590 | } | ||
591 | else if (!b) | ||
592 | return 1; | ||
593 | return strcmp (a, b); | ||
594 | } | ||
595 | |||
596 | static int | ||
597 | ent_cmp (const void *a, const void *b) | ||
598 | { | ||
599 | const struct sync_entry *sa = a; | ||
600 | const struct sync_entry *sb = b; | ||
601 | int rc; | ||
602 | |||
603 | rc = strcmp (sa->repo, sb->repo); | ||
604 | if (rc) | ||
605 | return rc; | ||
606 | rc = dir_cmp (sa->dir, sb->dir); | ||
607 | if (rc) | ||
608 | return rc; | ||
609 | return sa->files - sb->files; | ||
610 | } | ||
611 | |||
612 | int | 581 | int |
613 | do_sync (struct sync_entry *array, size_t count) | 582 | do_sync (struct sync_entry *array, size_t count) |
614 | { | 583 | { |
615 | int rc = 0; | 584 | int rc = 0; |
616 | struct sync_entry *sp, *lastp = NULL; | 585 | struct sync_entry *sp; |
617 | |||
618 | /* Sort the array */ | ||
619 | qsort (array, count, sizeof array[0], ent_cmp); | ||
620 | 586 | ||
621 | for (sp = array; sp < array + count; sp++) | 587 | for (sp = array; sp < array + count; sp++) |
622 | { | ||
623 | if (lastp) | ||
624 | { | ||
625 | if (strcmp (lastp->repo, sp->repo) == 0 | ||
626 | && dir_cmp (lastp->dir, sp->dir) == 0) | ||
627 | continue; | ||
628 | } | ||
629 | rc |= sync_www (sp->repo, sp->dir, sp->files); | 588 | rc |= sync_www (sp->repo, sp->dir, sp->files); |
630 | lastp = sp; | 589 | |
631 | } | ||
632 | if (debug) | 590 | if (debug) |
633 | fprintf (stderr, "do_sync: returning %d\n",rc); | 591 | fprintf (stderr, "do_sync: returning %d\n",rc); |
634 | return rc; | 592 | return rc; |