diff options
| author | Joseph Hunkeler <jhunkeler@gmail.com> | 2020-08-30 12:15:19 -0400 |
|---|---|---|
| committer | Joseph Hunkeler <jhunkeler@gmail.com> | 2020-08-30 12:15:26 -0400 |
| commit | efd42b3e1891be87137948eed8d4a71d7bd164e1 (patch) | |
| tree | 312b74e092e841921332726b0f47696970369ede | |
| parent | ab2449c39db62c884f48b0bf71b26f7645d02493 (diff) | |
| download | multihome-efd42b3e1891be87137948eed8d4a71d7bd164e1.tar.gz | |
Refuse to nest
| -rw-r--r-- | multihome.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/multihome.c b/multihome.c index 9daa216..23123c1 100644 --- a/multihome.c +++ b/multihome.c @@ -438,6 +438,13 @@ int main(int argc, char *argv[]) { sprintf(multihome.path_topdir, "%s/topdir", multihome.path_new); sprintf(multihome.marker, "%s/.multihome_controlled", multihome.path_new); + // Refuse to operate within a controlled home directory + char already_inside[PATH_MAX]; + sprintf(already_inside, "%s/.multihome_controlled", multihome.path_old); + if (access(already_inside, F_OK) == 0) { + fprintf(stderr, "error: cannot be nested.\n"); + return 1; + } // Create new home directory if (strcmp(multihome.path_new, multihome.path_old) != 0) { |
