Changeset View
Changeset View
Standalone View
Standalone View
usr.sbin/pw/pw_user.c
| Show First 20 Lines • Show All 109 Lines • ▼ Show 20 Lines | mkdir_home_parents(int dfd, const char *dir) | ||||
| tmp[0] = '\0'; | tmp[0] = '\0'; | ||||
| tmp = dirs; | tmp = dirs; | ||||
| if (fstatat(dfd, dirs, &st, 0) == -1) { | if (fstatat(dfd, dirs, &st, 0) == -1) { | ||||
| while ((tmp = strchr(tmp + 1, '/')) != NULL) { | while ((tmp = strchr(tmp + 1, '/')) != NULL) { | ||||
| *tmp = '\0'; | *tmp = '\0'; | ||||
| if (fstatat(dfd, dirs, &st, 0) == -1) { | if (fstatat(dfd, dirs, &st, 0) == -1) { | ||||
| if (mkdirat(dfd, dirs, _DEF_DIRMODE) == -1) | if (mkdirat(dfd, dirs, _DEF_DIRMODE) == -1) | ||||
| err(EX_OSFILE, "'%s' (home parent) is not a directory", dirs); | err(EX_OSFILE, | ||||
| "'%s' (home parent) is not a directory", | |||||
| dirs); | |||||
| if (fchownat(dfd, dirs, 0, 0, 0) != 0) | |||||
| warn("chown(%s)", dirs); | |||||
| } | } | ||||
| *tmp = '/'; | *tmp = '/'; | ||||
| } | } | ||||
| } | } | ||||
| if (fstatat(dfd, dirs, &st, 0) == -1) { | if (fstatat(dfd, dirs, &st, 0) == -1) { | ||||
| if (mkdirat(dfd, dirs, _DEF_DIRMODE) == -1) | if (mkdirat(dfd, dirs, _DEF_DIRMODE) == -1) | ||||
| err(EX_OSFILE, "'%s' (home parent) is not a directory", dirs); | err(EX_OSFILE, "'%s' (home parent) is not a directory", dirs); | ||||
| if (fchownat(dfd, dirs, 0, 0, 0) != 0) | if (fchownat(dfd, dirs, 0, 0, 0) != 0) | ||||
| ▲ Show 20 Lines • Show All 1,728 Lines • Show Last 20 Lines | |||||