if (readonly)
if (errno == ENOENT)
open_archive (struct locarhandle *ah, bool readonly){  struct stat64 st;  struct stat64 st2;  int fd;  struct locarhead head;  int retry = 0;  size_t prefix_len = output_prefix ? strlen (output_prefix) : 0;  char archivefname[prefix_len + sizeof (ARCHIVE_NAME)];  if (output_prefix)    memcpy (archivefname, output_prefix, prefix_len);  strcpy (archivefname + prefix_len, ARCHIVE_NAME); again:  /* Open the archive.  We must have exclusive write access.  */  fd = open64 (archivefname, readonly ? O_RDONLY : O_RDWR);  if (fd == -1)    {      /* Maybe the file does not yet exist.  */      if (errno == ENOENT)	{	  if (readonly)	    {	      static const struct locarhead nullhead =		{		  .namehash_used = 0,		  .namehash_offset = 0,		  .namehash_size = 0		};	      ah->addr = (void *) &nullhead;	      ah->fd = -1;	    }	  else	    create_archive (archivefname, ah);	  return;	}      else	error (EXIT_FAILURE, errno, _("cannot open locale archive \"%s\""),	       archivefname);    }  if (fstat64 (fd, &st) < 0)    error (EXIT_FAILURE, errno, _("cannot stat locale archive \"%s\""),	   archivefname);  if (!readonly && lockf64 (fd, F_LOCK, sizeof (struct locarhead)) == -1)    {      close (fd);      if (retry++ < max_locarchive_open_retry)	{	  struct timespec req;	  /* Wait for a bit.  */	  req.tv_sec = 0;	  req.tv_nsec = 1000000 * (random () % 500 + 1);	  (void) nanosleep (&req, NULL);	  goto again;	}      error (EXIT_FAILURE, errno, _("cannot lock locale archive \"%s\""),	     archivefname);    }  /* One more check.  Maybe another process replaced the archive file     with a new, larger one since we opened the file.  */  if (stat64 (archivefname, &st2) == -1      || st.st_dev != st2.st_dev      || st.st_ino != st2.st_ino)    {      (void) lockf64 (fd, F_ULOCK, sizeof (struct locarhead));      close (fd);      goto again;    }  /* Read the header.  */  if (TEMP_FAILURE_RETRY (read (fd, &head, sizeof (head))) != sizeof (head))    {      (void) lockf64 (fd, F_ULOCK, sizeof (struct locarhead));      error (EXIT_FAILURE, errno, _("cannot read archive header"));    }  ah->fd = fd;  ah->len = (head.sumhash_offset	     + head.sumhash_size * sizeof (struct sumhashent));  /* Now we know how large the administrative information part is.     Map all of it.  */  ah->addr = mmap64 (NULL, ah->len, PROT_READ | (readonly ? 0 : PROT_WRITE),		     MAP_SHARED, fd, 0);  if (ah->addr == MAP_FAILED)    {      (void) lockf64 (fd, F_ULOCK, sizeof (struct locarhead));      error (EXIT_FAILURE, errno, _("cannot map archive header"));    }}