Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitdbb787f

Browse files
committed
Propagate errno from remote agent
1 parent236a906 commitdbb787f

File tree

2 files changed

+23
-6
lines changed

2 files changed

+23
-6
lines changed

‎src/utils/file.c‎

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -535,7 +535,12 @@ int fio_fstat(int fd, struct stat* st)
535535
Assert(hdr.cop==FIO_FSTAT);
536536
IO_CHECK(fio_read_all(fio_stdin,st,sizeof(*st)),sizeof(*st));
537537

538-
returnhdr.arg;
538+
if (hdr.arg!=0)
539+
{
540+
errno=hdr.arg;
541+
return-1;
542+
}
543+
return0;
539544
}
540545
else
541546
{
@@ -563,7 +568,12 @@ int fio_stat(char const* path, struct stat* st, bool follow_symlinks, fio_locati
563568
Assert(hdr.cop==FIO_STAT);
564569
IO_CHECK(fio_read_all(fio_stdin,st,sizeof(*st)),sizeof(*st));
565570

566-
returnhdr.arg;
571+
if (hdr.arg!=0)
572+
{
573+
errno=hdr.arg;
574+
return-1;
575+
}
576+
return0;
567577
}
568578
else
569579
{
@@ -589,7 +599,12 @@ int fio_access(char const* path, int mode, fio_location location)
589599
IO_CHECK(fio_read_all(fio_stdin,&hdr,sizeof(hdr)),sizeof(hdr));
590600
Assert(hdr.cop==FIO_ACCESS);
591601

592-
returnhdr.arg;
602+
if (hdr.arg!=0)
603+
{
604+
errno=hdr.arg;
605+
return-1;
606+
}
607+
return0;
593608
}
594609
else
595610
{
@@ -1074,19 +1089,20 @@ void fio_communicate(int in, int out)
10741089
break;
10751090
caseFIO_FSTAT:/* Get information about opened file */
10761091
hdr.size=sizeof(st);
1077-
hdr.arg=fstat(fd[hdr.handle],&st);
1092+
hdr.arg=fstat(fd[hdr.handle],&st)<0 ?errno :0;
10781093
IO_CHECK(fio_write_all(out,&hdr,sizeof(hdr)),sizeof(hdr));
10791094
IO_CHECK(fio_write_all(out,&st,sizeof(st)),sizeof(st));
10801095
break;
10811096
caseFIO_STAT:/* Get information about file with specified path */
10821097
hdr.size=sizeof(st);
1083-
hdr.arg=hdr.arg ?stat(buf,&st) :lstat(buf,&st);
1098+
rc=hdr.arg ?stat(buf,&st) :lstat(buf,&st);
1099+
hdr.arg=rc<0 ?errno :0;
10841100
IO_CHECK(fio_write_all(out,&hdr,sizeof(hdr)),sizeof(hdr));
10851101
IO_CHECK(fio_write_all(out,&st,sizeof(st)),sizeof(st));
10861102
break;
10871103
caseFIO_ACCESS:/* Check presence of file with specified name */
10881104
hdr.size=0;
1089-
hdr.arg=access(buf,hdr.arg);
1105+
hdr.arg=access(buf,hdr.arg)<0 ?errno :0;
10901106
IO_CHECK(fio_write_all(out,&hdr,sizeof(hdr)),sizeof(hdr));
10911107
break;
10921108
caseFIO_RENAME:/* Rename file */

‎src/utils/remote.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ bool launch_agent(void)
128128
if (execvp(ssh_argv[0],ssh_argv)<0)
129129
return false;
130130
}else {
131+
elog(LOG,"Spawn agent %d",child_pid);
131132
SYS_CHECK(close(infd[1]));/* These are being used by the child */
132133
SYS_CHECK(close(outfd[0]));
133134
/*atexit(kill_child);*/

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp