Skip to content

Commit

Permalink
Pass undefined struct as workaround for segfault
Browse files Browse the repository at this point in the history
  • Loading branch information
rdmark committed Jan 29, 2024
1 parent c3c676f commit 580faae
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions cmdline/cmdline_afp.c
Original file line number Diff line number Diff line change
Expand Up @@ -626,15 +626,15 @@ static int com_get_file(char * arg, int silent,
printf(" Getting file %s\n",filename);

if ((access(localfilename,W_OK)) && (errno!=ENOENT)) {
printf("Trying to access %s\n",localfilename);
printf("Trying to access \"%s\"\n",localfilename);
perror("Access local file for write");
goto error;
}

get_server_path(filename,getattr_path);

if ((ret=ml_getattr(vol,getattr_path,&stat))!=0) {
printf("Could not get file attributes for file %s, return code %d\n",filename,ret);
printf("Could not get attributes for file \"%s\", return code %d\n",filename,ret);
goto error;
}

Expand Down Expand Up @@ -678,6 +678,7 @@ int com_view (char * arg)
{
unsigned long long amount_written;
char filename[AFP_MAX_PATH];
struct stat stat;

if ((server==NULL) || (vol==NULL)) {
printf("You're not connected yet to a volume\n");
Expand All @@ -688,8 +689,8 @@ int com_view (char * arg)
printf("expecting format: view <filename>\n");
goto error;
}
printf("Viewing: %s\n",filename);
retrieve_file(filename,fileno(stdout),1,NULL, &amount_written);
printf("Viewing: \"%s\"\n",filename);
retrieve_file(filename, fileno(stdout), 1, &stat, &amount_written);
return 0;
error:
return -1;
Expand Down

0 comments on commit 580faae

Please sign in to comment.