RPM Package Manager, CVS Repository
  http://rpm5.org/cvs/
  ____________________________________________________________________________

  Server: rpm5.org                         Name:   Jeff Johnson
  Root:   /v/rpm/cvs                       Email:  [email protected]
  Module: rpm                              Date:   14-Jul-2009 15:58:04
  Branch: HEAD                             Handle: 2009071413580400

  Modified files:
    rpm/rpmio               rpmdav.c

  Log:
    - rpmdav: fix: davStat/davLstat return -1 on error, with
    EAGAIN/ETIMEDOUT set.

  Summary:
    Revision    Changes     Path
    2.107       +25 -11     rpm/rpmio/rpmdav.c
  ____________________________________________________________________________

  patch -p0 <<'@@ .'
  Index: rpm/rpmio/rpmdav.c
  ============================================================================
  $ cvs diff -u -r2.106 -r2.107 rpmdav.c
  --- rpm/rpmio/rpmdav.c        10 Jul 2009 03:25:42 -0000      2.106
  +++ rpm/rpmio/rpmdav.c        14 Jul 2009 13:58:04 -0000      2.107
  @@ -78,9 +78,11 @@
   
   /* HACK: reasonable value needed (wget uses 900 as default). */
   #if 0
  -#define TIMEOUT_SECS 60
  +#define READ_TIMEOUT_SECS    120     /* neon-0.28.5 default */
  +#define CONNECT_TIMEOUT_SECS 0       /* neon-0.28.5 default */
   #else
  -#define TIMEOUT_SECS 5
  +#define READ_TIMEOUT_SECS    120
  +#define CONNECT_TIMEOUT_SECS 0       /* connect(2) EINPROGRESS if too low. */
   #endif
   
   /*...@unchecked@*/ /*...@observer@*/
  @@ -89,9 +91,9 @@
   /*...@unchecked@*/
   static int rpmioHttpPersist = 1;
   /*...@unchecked@*/
  -int rpmioHttpReadTimeoutSecs = TIMEOUT_SECS;
  +int rpmioHttpReadTimeoutSecs = READ_TIMEOUT_SECS;
   /*...@unchecked@*/
  -int rpmioHttpConnectTimeoutSecs = TIMEOUT_SECS;
  +int rpmioHttpConnectTimeoutSecs = CONNECT_TIMEOUT_SECS;
   #ifdef       NOTYET
   int rpmioHttpRetries = 20;
   int rpmioHttpRecurseMax = 5;
  @@ -586,6 +588,7 @@
        ne_set_persist(u->sess, rpmioHttpPersist);
   #endif
        ne_set_read_timeout(u->sess, rpmioHttpReadTimeoutSecs);
  +     ne_set_connect_timeout(u->sess, rpmioHttpConnectTimeoutSecs);
        ne_set_useragent(u->sess,
            (rpmioHttpUserAgent ? rpmioHttpUserAgent : _rpmioHttpUserAgent));
   
  @@ -1289,9 +1292,9 @@
        mode_t st_mode;
        int ut;
   
  +assert(html->b != NULL);
        be = html->b + html->nb;
        *be = '\0';
  -assert(html->b != NULL);
        offsets[0] = offsets[1] = -1;
        xx = mireRegexec(mire, html->b, html->nb);
        if (xx == 0 && offsets[0] != -1 && offsets[1] != -1) {
  @@ -1360,14 +1363,14 @@
            g = fe;
            while (g < be && *g && *g != '>')
                g++;
  -         if (*g != '>') {
  +         if (g >= be || *g != '>') {
                href = _free(href);
                goto refill;
            }
            ge = ++g;
            while (ge < be && *ge && *ge != '<')
                ge++;
  -         if (*ge != '<') {   
  +         if (ge >= be || *ge != '<') {       
                href = _free(href);
                goto refill;
            }
  @@ -1451,7 +1454,16 @@
       do {
        rc = ne_begin_request(html->req);
        rc = my_result("ne_begin_req(html->req)", rc, NULL);
  -     if (rc != NE_OK) goto exit;
  +     switch (rc) {
  +     case NE_OK:
  +         /*...@switchbreak@*/ break;
  +     case NE_TIMEOUT:
  +         errno = ETIMEDOUT;
  +         /*...@fallthrough@*/
  +     default:
  +         goto exit;
  +         /*...@notreached@*/ /*...@switchbreak@*/ break;
  +     }
   
        (void) htmlParse(html);         /* XXX error code needs handling. */
   
  @@ -2110,7 +2122,8 @@
       }
       rc = davNLST(avx);
       if (rc) {
  -/* HACK: errno = ??? */
  +     if (errno == 0) errno = EAGAIN; /* HACK: errno = ??? */
  +     rc = -1;
        goto exit;
       }
   
  @@ -2167,7 +2180,8 @@
       }
       rc = davNLST(avx);
       if (rc) {
  -/* HACK: errno = ??? */
  +     if (errno == 0) errno = EAGAIN; /* HACK: errno = ??? */
  +     rc = -1;
        goto exit;
       }
   
  @@ -2324,7 +2338,7 @@
   
       rc = davNLST(avx);
       if (rc) {
  -/* HACK: errno = ??? */
  +     if (errno == 0) errno = EAGAIN; /* HACK: errno = ??? */
        goto exit;
       } else
        avdir = (AVDIR) avOpendir(uri, avx->av, avx->modes);
  @@ .
______________________________________________________________________
RPM Package Manager                                    http://rpm5.org
CVS Sources Repository                                [email protected]

Reply via email to