debuggers.hg

changeset 21008:243614f8360c

Fix for fs-backend crash when xend was not started after system boot.

Signed-off-by: Daniel Kiper <dkiper@net-space.pl>
author Keir Fraser <keir.fraser@citrix.com>
date Mon Feb 22 10:06:21 2010 +0000 (2010-02-22)
parents 628600e0e3b4
children 70d974c2401d
files tools/fs-back/fs-backend.c tools/fs-back/fs-xenbus.c
line diff
     1.1 --- a/tools/fs-back/fs-backend.c	Mon Feb 22 10:05:40 2010 +0000
     1.2 +++ b/tools/fs-back/fs-backend.c	Mon Feb 22 10:06:21 2010 +0000
     1.3 @@ -300,7 +300,8 @@ static void await_connections(void)
     1.4      LIST_INIT (&mount_requests_head);
     1.5  
     1.6      assert(xsh != NULL);
     1.7 -    fd = xenbus_get_watch_fd(); 
     1.8 +    if ((fd = xenbus_get_watch_fd()) == -1)
     1.9 +	    err(1, "xenbus_get_watch_fd: could not setup watch");
    1.10      /* Infinite watch loop */
    1.11      do {
    1.12  	FD_ZERO(&fds);
     2.1 --- a/tools/fs-back/fs-xenbus.c	Mon Feb 22 10:05:40 2010 +0000
     2.2 +++ b/tools/fs-back/fs-xenbus.c	Mon Feb 22 10:06:21 2010 +0000
     2.3 @@ -105,11 +105,18 @@ error_exit:
     2.4  int xenbus_get_watch_fd(void)
     2.5  {
     2.6      int res;
     2.7 +#if DEBUG
     2.8 +    int errno_orig;
     2.9 +#endif
    2.10      assert(xsh != NULL);
    2.11      res = xs_watch(xsh, WATCH_NODE, "conn-watch");
    2.12      if (!res) {
    2.13 +#if DEBUG
    2.14 +	errno_orig = errno;
    2.15          FS_DEBUG("ERROR: xs_watch %s failed ret=%d errno=%d\n",
    2.16                   WATCH_NODE, res, errno);
    2.17 +	errno = errno_orig;
    2.18 +#endif
    2.19          return -1;
    2.20      }
    2.21      return xs_fileno(xsh);