]> git.decadent.org.uk Git - nfs-utils.git/blobdiff - support/nfs/xio.c
2000-12-03 Chip Salzenberg <chip@valinux.com>
[nfs-utils.git] / support / nfs / xio.c
index 49ee6bc2eac3da43fc0d0dccd4330f7ccf38edaf..db5e2c3aa500e2378c711707b55b1b62e7e62327 100644 (file)
@@ -29,7 +29,7 @@ xfopen(char *fname, char *type)
                return NULL;
        xfp = (XFILE *) xmalloc(sizeof(*xfp));
        xfp->x_fp = fp;
                return NULL;
        xfp = (XFILE *) xmalloc(sizeof(*xfp));
        xfp->x_fp = fp;
-       xfp->x_line = 0;
+       xfp->x_line = 1;
 
        return xfp;
 }
 
        return xfp;
 }
@@ -55,7 +55,7 @@ xflock(char *fname, char *type)
        struct flock    fl = { readonly? F_RDLCK : F_WRLCK, SEEK_SET, 0, 0, 0 };
        int             fd;
 
        struct flock    fl = { readonly? F_RDLCK : F_WRLCK, SEEK_SET, 0, 0, 0 };
        int             fd;
 
-       if ((fd = open(fname, readonly? O_RDONLY : O_RDWR)) < 0) {
+       if ((fd = open(fname, readonly? O_RDONLY : (O_RDWR|O_CREAT))) < 0) {
                xlog(L_WARNING, "could not open %s for locking", fname);
                return -1;
        }
                xlog(L_WARNING, "could not open %s for locking", fname);
                return -1;
        }