コード例 #1
0
ファイル: misc.c プロジェクト: Happuri/various
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
ファイル: misc.c プロジェクト: Happuri/various
/* 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
ファイル: misc.c プロジェクト: Happuri/various
/* 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
ファイル: paxerror.c プロジェクト: ihutch/sceptic3D
void
stat_fatal (char const *name)
{
  call_arg_fatal ("stat", name);
}