MCPcopy Create free account
hub / github.com/eggert/tz / change_directory

Function change_directory

zic.c:940–955  ·  view source on GitHub ↗

Change the working directory to DIR, possibly creating DIR and its ancestors. After this is done, all files are accessed with names relative to DIR. */

Source from the content-addressed store, hash-verified

938/* Change the working directory to DIR, possibly creating DIR and its
939 ancestors. After this is done, all files are accessed with names
940 relative to DIR. */
941static void
942change_directory(char const *dir)
943{
944 if (chdir(dir) != 0) {
945 int chdir_errno = errno;
946 if (chdir_errno == ENOENT) {
947 mkdirs(dir, false);
948 chdir_errno = chdir(dir) == 0 ? 0 : errno;
949 }
950 if (chdir_errno != 0) {
951 fprintf(stderr, _("%s: Can't chdir to %s: %s\n"),
952 progname, dir, strerror(chdir_errno));
953 exit(EXIT_FAILURE);
954 }
955 }
956}
957
958/* Compare the two links A and B, for a stable sort by link name. */

Callers 1

mainFunction · 0.85

Calls 1

mkdirsFunction · 0.85

Tested by

no test coverage detected