bad_rename

bad_rename - if (rv==0) { /* don't try to remove it */...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
/* * rename */ #include <unistd.h> #include <errno.h> #include "test.h" static void rename_dot(void) { int rv; rv = rename(".", TESTDIR); report_test(rv, errno, EINVAL, "rename ."); if (rv==0) { /* oops. .. put it back */ rename(TESTDIR, "."); } } static void rename_dotdot(void) { int rv; rv = rename(". .", TESTDIR); report_test(rv, errno, EINVAL, "rename . ."); if (rv==0) { /* oops. .. put it back */ rename(TESTDIR, ". ."); } } static void rename_empty1(void) { int rv; rv = rename("", TESTDIR); report_test2(rv, errno, EISDIR, EINVAL, "rename empty string");
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: if (rv==0) { /* don't try to remove it */ rename(TESTDIR, TESTDIR &quot;-foo&quot;); } } static void rename_empty2(void) { int rv; if (create_testdir()&lt;0) { return; } rv = rename(TESTDIR, &quot;&quot;); report_test2(rv, errno, EISDIR, EINVAL, &quot;rename to empty string&quot;); rmdir(TESTDIR); } void test_rename(void) { test_rename_paths(); rename_dot(); rename_dotdot(); rename_empty1(); rename_empty2(); }...
View Full Document

This note was uploaded on 11/10/2009 for the course CS 536 taught by Professor Lums during the Spring '09 term at Indiana.

Page1 / 2

bad_rename - if (rv==0) { /* don't try to remove it */...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online