=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/rcs/rcsutil.c,v retrieving revision 1.36 retrieving revision 1.37 diff -u -r1.36 -r1.37 --- src/usr.bin/rcs/rcsutil.c 2010/09/08 15:15:50 1.36 +++ src/usr.bin/rcs/rcsutil.c 2010/10/20 19:53:53 1.37 @@ -1,4 +1,4 @@ -/* $OpenBSD: rcsutil.c,v 1.36 2010/09/08 15:15:50 tobias Exp $ */ +/* $OpenBSD: rcsutil.c,v 1.37 2010/10/20 19:53:53 tobias Exp $ */ /* * Copyright (c) 2005, 2006 Joris Vink * Copyright (c) 2006 Xavier Santolaria @@ -50,7 +50,10 @@ struct stat st; time_t mtime; - if (fstat(file->rf_fd, &st) == -1) { + if (file->rf_file == NULL) + return (-1); + + if (fstat(fileno(file->rf_file), &st) == -1) { warn("%s", file->rf_path); return (-1); } @@ -70,13 +73,13 @@ { static struct timeval tv[2]; - if (mtime == -1) + if (file->rf_file == NULL || mtime == -1) return; tv[0].tv_sec = mtime; tv[1].tv_sec = tv[0].tv_sec; - if (futimes(file->rf_fd, tv) == -1) + if (futimes(fileno(file->rf_file), tv) == -1) err(1, "utimes"); }