aboutsummaryrefslogtreecommitdiff
path: root/cvs/sv_sync_www.c
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2009-03-19 17:15:01 +0000
committerSergey Poznyakoff <gray@gnu.org.ua>2009-03-19 17:15:01 +0000
commitce1f26c5f10d4a1a2c4c0de789371fedf2d4c88d (patch)
tree49ca73607b531606dd92df98ea1f2e294401cfef /cvs/sv_sync_www.c
parent30d4d8eedf640ce1c8b9a4ba5bd583075a1beceb (diff)
downloadgsc-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
Diffstat (limited to 'cvs/sv_sync_www.c')
-rw-r--r--cvs/sv_sync_www.c48
1 files changed, 3 insertions, 45 deletions
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
581static int
582dir_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
596static int
597ent_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
612int 581int
613do_sync (struct sync_entry *array, size_t count) 582do_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 586
618 /* Sort the array */
619 qsort (array, count, sizeof array[0], ent_cmp);
620
621 for (sp = array; sp < array + count; sp++) 587 for (sp = array; sp < array + count; sp++)
622 { 588 rc |= sync_www (sp->repo, sp->dir, sp->files);
623 if (lastp) 589
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);
630 lastp = sp;
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;

Return to:

Send suggestions and report system problems to the System administrator.