rem: if (status)
add: ok = (futimens (fd, file, t) == 0); if (fd != -1) ok &= (close (fd) == 0);  if (!ok)
context: touch (const char *file){  int status;  struct stat sbuf;  int fd = -1;  int open_errno = 0;  if (! no_create)    {      /* Try to open FILE, creating it if necessary.  */      fd = open (file, O_WRONLY | O_CREAT | O_NONBLOCK | O_NOCTTY,		 S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH);      /* Don't save a copy of errno if it's EISDIR, since that would lead	 touch to give a bogus diagnostic for e.g., `touch /' (assuming	 we don't own / or have write access to it).  On Solaris 5.6,	 and probably other systems, it is EINVAL.  On SunOS4, it's EPERM.  */      if (fd == -1 && errno != EISDIR && errno != EINVAL && errno != EPERM)	open_errno = errno;    }  if (! amtime_now)    {      /* We're setting only one of the time values.  stat the target to get	 the other one.  If we have the file descriptor already, use fstat.	 Otherwise, either we're in no-create mode (and hence didn't call open)	 or FILE is inaccessible or a directory, so we have to use stat.  */      if (fd != -1 ? fstat (fd, &sbuf) : stat (file, &sbuf))	{	  if (open_errno)	    error (0, open_errno, _("creating %s"), quote (file));	  else	    {	      if (no_create && errno == ENOENT)		return 0;	      error (0, errno, _("failed to get attributes of %s"),		     quote (file));	    }	  close (fd);	  return 1;	}    }  if (fd != -1 && close (fd) < 0)    {      error (0, errno, _("creating %s"), quote (file));      return 1;    }  if (amtime_now)    {      /* Pass NULL to utime so it will not fail if we just have	 write access to the file, but don't own it.  */      status = utime (file, NULL);    }  else    {      struct utimbuf utb;      /* There's currently no interface to set file timestamps with	 better than 1-second resolution, so discard any fractional	 part of the source timestamp.  */      if (use_ref)	{	  utb.actime = ref_stats.st_atime;	  utb.modtime = ref_stats.st_mtime;	}      else	utb.actime = utb.modtime = newtime;      if (!(change_times & CH_ATIME))	utb.actime = sbuf.st_atime;      if (!(change_times & CH_MTIME))	utb.modtime = sbuf.st_mtime;      status = utime (file, &utb);    }  if (status)    {      if (open_errno)	{	  /* The wording of this diagnostic should cover at least two cases:	     - the file does not exist, but the parent directory is unwritable	     - the file exists, but it isn't writable	     I think it's not worth trying to distinguish them.  */	  error (0, open_errno, _("cannot touch %s"), quote (file));	}      else	{	  if (no_create && errno == ENOENT)	    return 0;	  error (0, errno, _("setting times of %s"), quote (file));	}      return 1;    }  return 0;}