X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Ftests%2Fllapi_fid_test.c;h=c0fe8c43d03918295da180be4a38386d5edf6cc6;hb=b78fb445555916e380b1661546c821df14098596;hp=e7d18f95a57a141b6276b8ad384ed6511ea948fe;hpb=c58d3c5a102f97c6014b9a6342e6f7afd3a5cf5c;p=fs%2Flustre-release.git diff --git a/lustre/tests/llapi_fid_test.c b/lustre/tests/llapi_fid_test.c index e7d18f9..c0fe8c4 100644 --- a/lustre/tests/llapi_fid_test.c +++ b/lustre/tests/llapi_fid_test.c @@ -15,11 +15,7 @@ * * You should have received a copy of the GNU General Public License * version 2 along with this program; If not, see - * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. + * http://www.gnu.org/licenses/gpl-2.0.html * * GPL HEADER END */ @@ -42,6 +38,7 @@ #include #include #include +#include #include #include @@ -105,7 +102,7 @@ static void helper_fid2path(const char *filename, int fd) lustre_fid fid; lustre_fid fid2; lustre_fid fid3; - char fidstr[FID_LEN]; + char fidstr[FID_LEN + 1]; char path1[PATH_MAX]; char path2[PATH_MAX]; char path3[PATH_MAX]; @@ -241,7 +238,7 @@ static void test11(void) int rc; int fd; lustre_fid fid; - char fidstr[FID_LEN]; + char fidstr[FID_LEN + 1]; char path[PATH_MAX]; long long recno; int linkno; @@ -282,7 +279,7 @@ static void test12(void) rc = mkdir(mainpath, 0); ASSERTF(rc == 0, "mkdir failed for '%s': %s", mainpath, strerror(errno)); - fd = llapi_create_volatile_idx(mainpath, -1, 0600); + fd = llapi_create_volatile_idx(mainpath, -1, 0); ASSERTF(fd >= 0, "creat failed for '%s': %s", mainpath, strerror(errno)); @@ -291,7 +288,7 @@ static void test12(void) mainpath, strerror(-rc)); /* No many ways to test, except to open by fid. */ - fd2 = llapi_open_by_fid(mainpath, &fid, 0600); + fd2 = llapi_open_by_fid(mainpath, &fid, O_RDONLY); ASSERTF(fd2 >= 0, "llapi_open_by_fid for " DFID_NOBRACE ": %s", PFID(&fid), strerror(errno)); @@ -299,7 +296,7 @@ static void test12(void) /* Check the file can still be opened, since fd2 is not * closed. */ - fd3 = llapi_open_by_fid(mainpath, &fid, 0600); + fd3 = llapi_open_by_fid(mainpath, &fid, O_RDONLY); ASSERTF(fd3 >= 0, "llapi_open_by_fid for " DFID_NOBRACE ": %s", PFID(&fid), strerror(errno)); @@ -307,7 +304,7 @@ static void test12(void) close(fd3); /* The volatile file is gone now. */ - fd = llapi_open_by_fid(mainpath, &fid, 0600); + fd = llapi_open_by_fid(mainpath, &fid, O_RDONLY); ASSERTF(fd < 0, "llapi_open_by_fid for " DFID_NOBRACE ": %d", PFID(&fid), fd); } @@ -371,7 +368,7 @@ static void test30(void) char buf[PATH_MAX]; char buf2[PATH_MAX]; lustre_fid fid; - char fidstr[FID_LEN]; + char fidstr[FID_LEN + 1]; int rc; int i; int j; @@ -698,7 +695,7 @@ static void process_args(int argc, char *argv[]) int main(int argc, char *argv[]) { - char fsname[8]; + char fsname[8 + 1]; int rc; process_args(argc, argv);