[cs631apue] tcp Failure test failed [tcp file file2]

mseaton mseaton at stevens.edu
Sat Sep 17 14:30:15 EDT 2016


Hi Prof Schaumann,
Are you saying that ./cp file1 file2 should generate an error? I thought 
this should only happen if if file1 which is the source file does not 
exist. I assumed that file1 and file2 are different files. Just 
clarifying your reply.
Marlon
On 09/17/2016 11:21 AM, Jan Schaumann wrote:
> Runxi Ding <rding6 at stevens.edu> wrote:
> 
>> rding6 at rainman:~/cs631$ /home/rding6/cs631/a.out file file2
>> Unable to open file: No such file or directory
>> rding6 at rainman:~/cs631$ echo $?
>> 1
> 
> This shows that your program returns an error when it tries to copy a
> non-existent file.
> 
> The test case in the script checks if your program fails when it tries
> to copy a file onto itself (albeit by another name).
> 
> Read the test script:
> 
>  cp ${TEST_FILE} file
>  ln file file2
>  <your-executable> file file2
> 
> That is, it first copies a test file to 'file', then creates a hard 
> link
> to file named 'file2'.  Now 'file' and 'file2' are the exact same file
> (verify by checking the inode via 'ls -li file file2'), so copying
> 'file' to 'file2' should return an error, but it looks like your 
> program
> does not fail in this case.
> 
> -Jan
> _______________________________________________
> cs631apue mailing list
> cs631apue at lists.stevens.edu
> https://lists.stevens.edu/mailman/listinfo/cs631apue


More information about the cs631apue mailing list