X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Ftests%2Fcheckstat.c;h=efc3afcc03d8121a2be736162b87617ad4375384;hb=8ed361345154138473707855b2030bad371e96dd;hp=acfdfa890e8e58cf8f2d9ab6c66a29bedfaa026c;hpb=c253b6e9a3fa11948f72c4570d83081646eb3049;p=fs%2Flustre-release.git diff --git a/lustre/tests/checkstat.c b/lustre/tests/checkstat.c index acfdfa8..efc3afc 100644 --- a/lustre/tests/checkstat.c +++ b/lustre/tests/checkstat.c @@ -1,3 +1,40 @@ +/* + * 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) 2002, 2010, Oracle and/or its affiliates. All rights reserved. + * Use is subject to license terms. + * + * Copyright (c) 2011, Intel Corporation. + */ +/* + * Test program to compare the attributes of a files to verify that it + * desired file attributes are present. This file predates availability + * of the stat(3) utility and is deprecated. Either test(3) ([ ]) or + * stat(3) should be used in all new tests. + * + * This file is part of Lustre, http://www.lustre.org/ + * Lustre is a trademark of Sun Microsystems, Inc. + */ + #include #include #include @@ -90,34 +127,15 @@ main (int argc, char **argv) fprintf (stderr, "Can't parse numeric uid %s\n", optarg); return (1); } - }else { - int i,flag=0; - char * temp ; - temp = optarg; - for(i=0;ipw_uid; - + fprintf (stderr, "Can't find user %s\n", optarg); + return (1); } - else - uid=(uid_t)atol(optarg); + uid = pw->pw_uid; } break; @@ -259,20 +277,18 @@ main (int argc, char **argv) fname, perms); } - if (size != -1) - { - if (buf.st_size != size) - { - if (verbose) - printf ("%s has size %Ld, not %Ld\n", - fname, (long long)buf.st_size, - size); - return (1); - } - - if (verbose) - printf ("%s has size %Ld OK\n", fname, size); - } + if (size != -1) { + if (buf.st_size != size) { + if (verbose) + printf("%s has size %lld, not %lld\n", + fname, (long long)buf.st_size, + size); + return 1; + } + + if (verbose) + printf("%s has size %lld OK\n", fname, size); + } if (checklink != NULL) {