Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for writing mda files to subdirectories on Linux #33

Merged
merged 1 commit into from
Jul 31, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 15 additions & 6 deletions sscanApp/src/saveData_writeXDR.c
Original file line number Diff line number Diff line change
Expand Up @@ -719,23 +719,32 @@ LOCAL int fileStatus(char* fname)
{
struct stat status;
int retVal;

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove the trailing whitespace

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This whitespace makes the indentation consistent across the entire function (see attached screenshot).

Screenshot from 2024-07-24 15-02-09

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK

errno = 0;

int len;
char lastChar;

char *fnameLocal;

len = strlen(fname);
lastChar = fname[len-1];

/* Use a local copy of the filename */
fnameLocal = (char *)calloc(len+1, sizeof(char));
strcpy(fnameLocal, fname);

lastChar = fnameLocal[len-1];
if ((lastChar == '/') || (lastChar == '\\'))
{
fname[len-1] = 0;
fnameLocal[len-1] = 0;
}

retVal = stat(fname, &status);
retVal = stat(fnameLocal, &status);
if ((retVal == -1) && (debug_saveData)) {
printf("saveData: stat returned -1 for filename '%s'; errno=%d\n", fname, errno);
printf("saveData: stat returned -1 for filename '%s'; errno=%d\n", fnameLocal, errno);
}

free(fnameLocal);

return retVal;
}

Expand Down
Loading