Skip to content

Commit

Permalink
lib/gis: lib/display, fixing slash to HOST_DIRSEP
Browse files Browse the repository at this point in the history
Fixes hardcoded slash to HOST_DIRSEP.

Fixes #3296
  • Loading branch information
neteler committed Jun 16, 2024
1 parent 311aa0d commit 4a6fec9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
5 changes: 3 additions & 2 deletions lib/display/r_raster.c
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ int D_open_driver(void)
if (!p && (m || c)) {
char *cmd;
char progname[GPATH_MAX];
char sep[2] = {HOST_DIRSEP, '\0'};

cmd = G_recreate_command();

Expand All @@ -108,9 +109,9 @@ int D_open_driver(void)
char element[GPATH_MAX];

G_temp_element(element);
strcat(element, "/");
strcat(element, sep);
strcat(element, "MONITORS");
strcat(element, "/");
strcat(element, sep);
strcat(element, m);
G_file_name(progname, element, "render.py", G_mapset());
}
Expand Down
6 changes: 4 additions & 2 deletions lib/gis/tempfile.c
Original file line number Diff line number Diff line change
Expand Up @@ -159,11 +159,12 @@ void G_temp_element(char *element)
void G__temp_element(char *element, int tmp)
{
const char *machine;
char sep[2] = {HOST_DIRSEP, '\0'};

strcpy(element, ".tmp");
machine = G__machine_name();
if (machine != NULL && *machine != 0) {
strcat(element, "/");
strcat(element, sep);
strcat(element, machine);
}

Expand All @@ -185,11 +186,12 @@ void G__temp_element(char *element, int tmp)
void G__temp_element_basedir(char *element, const char *basedir)
{
const char *machine;
char sep[2] = {HOST_DIRSEP, '\0'};

strcpy(element, ".tmp");
machine = G__machine_name();
if (machine != NULL && *machine != 0) {
strcat(element, "/");
strcat(element, sep);
strcat(element, machine);
}

Expand Down

0 comments on commit 4a6fec9

Please sign in to comment.