17 #include <sys/types.h> 22 static int make_mapset_element(
const char *,
const char *);
43 return make_mapset_element(path, p_element);
61 return make_mapset_element(path, p_element);
64 int make_mapset_element(
const char *p_path,
const char *p_element)
86 if (*element ==
'/' || *element == 0) {
88 if (access(path, 0) != 0) {
91 p_element, path, strerror(errno));
93 if (access(path, 0) != 0)
95 p_element, path, strerror(errno));
116 sprintf(buf,
"%s/%s", dir, name);
120 static int check_owner(
const struct stat *info)
122 #if defined(__MINGW32__) || defined(SKIP_MAPSET_OWN_CHK) 125 const char *check =
getenv(
"GRASS_SKIP_MAPSET_OWNER_CHECK");
128 if (info->st_uid != getuid())
130 if (info->st_uid != geteuid())
152 if (
G_stat(path, &info) != 0)
154 if (!S_ISDIR(info.st_mode))
157 if (!check_owner(&info))
180 sprintf(path,
"%s/%s/%s", gisdbase, location, mapset);
182 if (
G_stat(path, &info) != 0)
184 if (!S_ISDIR(info.st_mode))
187 if (!check_owner(&info))
int G_make_mapset_element(const char *p_element)
Create element in the current mapset.
char * G_file_name(char *, const char *, const char *, const char *)
Builds full path names to GIS data files.
void void void void G_fatal_error(const char *,...) __attribute__((format(printf
int G_mapset_permissions(const char *mapset)
Check for user mapset permission.
int G_mapset_permissions2(const char *gisdbase, const char *location, const char *mapset)
Check for user mapset permission.
int G_stat(const char *, struct stat *)
Get file status.
int G__make_mapset_element_misc(const char *dir, const char *name)
Create misc element in the current mapset.
char * G_file_name_tmp(char *, const char *, const char *, const char *)
Builds full path names to GIS data files in temporary directory (for internal use only) ...
const char * G_mapset(void)
Get current mapset name.
int G_mkdir(const char *)
Creates a new directory.
int G_make_mapset_element_tmp(const char *p_element)
Create element in the temporary directory.