+++ /dev/null
-/*
- * GPL HEADER START
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 only,
- * as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License version 2 for more details (a copy is included
- * in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU General Public License
- * version 2 along with this program; If not, see
- * http://www.gnu.org/licenses/gpl-2.0.html
- *
- * GPL HEADER END
- */
-/*
- * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
- * Use is subject to license terms.
- *
- * Copyright (c) 2013, Intel Corporation.
- */
-/*
- * This file is part of Lustre, http://www.lustre.org/
- */
-
-#include <stdio.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <errno.h>
-#include <string.h>
-#include <fcntl.h>
-#include <unistd.h>
-
-int main(int argc, char ** argv)
-{
- int rc;
-
- if (argc < 3) {
- fprintf(stderr, "usage: %s file link\n", argv[0]);
- return 1;
- }
-
- rc = link(argv[1], argv[2]);
- if (rc) {
- fprintf(stderr, "link(%s, %s) error: %s\n",
- argv[1], argv[2], strerror(errno));
- return errno;
- }
- return 0;
-}
test_mkdir -c1 -p $DIR/$tdir/dir1
ln $DIR/$tdir/dir1 $DIR/$tdir/dir2 && error "ln for dir"
link $DIR/$tdir/dir1 $DIR/$tdir/dir3 && error "link for dir"
- mlink $DIR/$tdir/dir1 $DIR/$tdir/dir4 && error "mlink for dir"
- mlink $DIR/$tdir/dir1 $DIR/$tdir/dir1 && error "mlink to the same dir"
+ link $DIR/$tdir/dir1 $DIR/$tdir/dir1 && error "link to the same dir"
return 0
}
-run_test 31j "link for directory==============="
+run_test 31j "link for directory"
test_31k() {
- test_mkdir -c1 -p $DIR/$tdir
- touch $DIR/$tdir/s
- touch $DIR/$tdir/exist
- mlink $DIR/$tdir/s $DIR/$tdir/t || error "mlink"
- mlink $DIR/$tdir/s $DIR/$tdir/exist && error "mlink to exist file"
- mlink $DIR/$tdir/s $DIR/$tdir/s && error "mlink to the same file"
- mlink $DIR/$tdir/s $DIR/$tdir && error "mlink to parent dir"
- mlink $DIR/$tdir $DIR/$tdir/s && error "mlink parent dir to target"
- mlink $DIR/$tdir/not-exist $DIR/$tdir/foo && error "mlink non-existing to new"
- mlink $DIR/$tdir/not-exist $DIR/$tdir/s && error "mlink non-existing to exist"
+ test_mkdir -c1 -p $DIR/$tdir
+ touch $DIR/$tdir/s
+ touch $DIR/$tdir/exist
+ link $DIR/$tdir/s $DIR/$tdir/t || error "link"
+ link $DIR/$tdir/s $DIR/$tdir/exist && error "link to exist file"
+ link $DIR/$tdir/s $DIR/$tdir/s && error "link to the same file"
+ link $DIR/$tdir/s $DIR/$tdir && error "link to parent dir"
+ link $DIR/$tdir $DIR/$tdir/s && error "link parent dir to target"
+ link $DIR/$tdir/not-exist $DIR/$tdir/foo && error "link non-existing to new"
+ link $DIR/$tdir/not-exist $DIR/$tdir/s && error "link non-existing to exist"
return 0
}
-run_test 31k "link to file: the same, non-existing, dir==============="
+run_test 31k "link to file: the same, non-existing, dir"
test_31l() {
local ln_ver=$(ln --version | awk '/coreutils/ { print $4 }')
run_test 31l "link to file: target dir has trailing slash"
test_31m() {
- mkdir $DIR/d31m
- touch $DIR/d31m/s
- mkdir $DIR/d31m2
- touch $DIR/d31m2/exist
- mlink $DIR/d31m/s $DIR/d31m2/t || error "mlink"
- mlink $DIR/d31m/s $DIR/d31m2/exist && error "mlink to exist file"
- mlink $DIR/d31m/s $DIR/d31m2 && error "mlink to parent dir"
- mlink $DIR/d31m2 $DIR/d31m/s && error "mlink parent dir to target"
- mlink $DIR/d31m/not-exist $DIR/d31m2/foo && error "mlink non-existing to new"
- mlink $DIR/d31m/not-exist $DIR/d31m2/s && error "mlink non-existing to exist"
+ mkdir $DIR/d31m
+ touch $DIR/d31m/s
+ mkdir $DIR/d31m2
+ touch $DIR/d31m2/exist
+ link $DIR/d31m/s $DIR/d31m2/t || error "link"
+ link $DIR/d31m/s $DIR/d31m2/exist && error "link to exist file"
+ link $DIR/d31m/s $DIR/d31m2 && error "link to parent dir"
+ link $DIR/d31m2 $DIR/d31m/s && error "link parent dir to target"
+ link $DIR/d31m/not-exist $DIR/d31m2/foo && error "link non-existing to new"
+ link $DIR/d31m/not-exist $DIR/d31m2/s && error "link non-existing to exist"
return 0
}
-run_test 31m "link to file: the same, non-existing, dir==============="
+run_test 31m "link to file: the same, non-existing, dir"
test_31n() {
touch $DIR/$tfile || error "cannot create '$DIR/$tfile'"
link_one() {
local tempfile=$(mktemp $1_XXXXXX)
- mlink $tempfile $1 2> /dev/null &&
+ link $tempfile $1 2> /dev/null &&
echo "$BASHPID: link $tempfile to $1 succeeded"
unlink $tempfile
}