Пример #1
0
char *
normalize_filename (int cdidx, const char *name)
{
  char *copy = NULL;

  if (IS_RELATIVE_FILE_NAME (name))
    {
      /* Set COPY to the absolute path for this name.

         FIXME: There should be no need to get the absolute file name.
         tar_getcdpath does not return a true "canonical" path, so
         this following approach may lead to situations where the same
         file or directory is processed twice under different absolute
         paths without that duplication being detected.  Perhaps we
         should use dev+ino pairs instead of names?  */
      const char *cdpath = tar_getcdpath (cdidx);
      size_t copylen;
      bool need_separator;

      if (!cdpath)
	call_arg_fatal ("getcwd", ".");
      copylen = strlen (cdpath);
      need_separator = ! (DOUBLE_SLASH_IS_DISTINCT_ROOT
			  && copylen == 2 && ISSLASH (cdpath[1]));
      copy = xmalloc (copylen + need_separator + strlen (name) + 1);
      strcpy (copy, cdpath);
      copy[copylen] = DIRECTORY_SEPARATOR;
      strcpy (copy + copylen + need_separator, name);
    }

  if (!copy)
    copy = xstrdup (name);
  normalize_filename_x (copy);
  return copy;
}
Пример #2
0
/* Fork, aborting if unsuccessful.  */
pid_t
xfork (void)
{
  pid_t p = fork ();
  if (p == (pid_t) -1)
    call_arg_fatal ("fork", _("child process"));
  return p;
}
Пример #3
0
/* Create a pipe, aborting if unsuccessful.  */
void
xpipe (int fd[2])
{
  if (pipe (fd) < 0)
    call_arg_fatal ("pipe", _("interprocess channel"));
}
Пример #4
0
void
write_fatal (char const *name)
{
  call_arg_fatal ("write", name);
}
Пример #5
0
void
read_fatal (char const *name)
{
  call_arg_fatal ("read", name);
}
Пример #6
0
void
open_fatal (char const *name)
{
  call_arg_fatal ("open", name);
}
Пример #7
0
void
exec_fatal (char const *name)
{
  call_arg_fatal ("exec", name);
}
Пример #8
0
void
chdir_fatal (char const *name)
{
  call_arg_fatal ("chdir", name);
}
Пример #9
0
void
stat_fatal (char const *name)
{
  call_arg_fatal ("stat", name);
}