plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 1 | /* |
| 2 | * |
| 3 | * Copyright (c) International Business Machines Corp., 2001 |
| 4 | * |
| 5 | * This program is free software; you can redistribute it and/or modify |
| 6 | * it under the terms of the GNU General Public License as published by |
| 7 | * the Free Software Foundation; either version 2 of the License, or |
| 8 | * (at your option) any later version. |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See |
| 13 | * the GNU General Public License for more details. |
| 14 | * |
| 15 | * You should have received a copy of the GNU General Public License |
| 16 | * along with this program; if not, write to the Free Software |
Wanlong Gao | 4548c6c | 2012-10-19 18:03:36 +0800 | [diff] [blame] | 17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 18 | */ |
| 19 | |
| 20 | /* |
| 21 | * Test Name: utime03 |
| 22 | * |
| 23 | * Test Description: |
| 24 | * Verify that the system call utime() successfully sets the modification |
| 25 | * and access times of a file to the current time, under the following |
| 26 | * constraints, |
| 27 | * - The times argument is null. |
| 28 | * - The user ID of the process is not "root". |
| 29 | * - The file is not owned by the user ID of the process. |
| 30 | * - The user ID of the process has write access to the file. |
| 31 | * |
| 32 | * Expected Result: |
| 33 | * utime succeeds returning zero and sets the access and modificatio |
| 34 | * times of the file to the current time. |
| 35 | * |
| 36 | * Algorithm: |
| 37 | * Setup: |
| 38 | * Setup signal handling. |
| 39 | * Create temporary directory. |
| 40 | * Pause for SIGUSR1 if option specified. |
| 41 | * |
| 42 | * Test: |
| 43 | * Loop if the proper options are given. |
| 44 | * Execute system call |
| 45 | * Check return code, if system call failed (return=-1) |
subrata_modak | 56207ce | 2009-03-23 13:35:39 +0000 | [diff] [blame] | 46 | * Log the errno and Issue a FAIL message. |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 47 | * Otherwise, |
subrata_modak | 56207ce | 2009-03-23 13:35:39 +0000 | [diff] [blame] | 48 | * Verify the Functionality of system call |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 49 | * if successful, |
subrata_modak | 56207ce | 2009-03-23 13:35:39 +0000 | [diff] [blame] | 50 | * Issue Functionality-Pass message. |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 51 | * Otherwise, |
| 52 | * Issue Functionality-Fail message. |
| 53 | * Cleanup: |
| 54 | * Print errno log and/or timing stats if options given |
| 55 | * Delete the temporary directory created. |
| 56 | * |
| 57 | * Usage: <for command-line> |
| 58 | * utime03 [-c n] [-e] [-f] [-i n] [-I x] [-p x] [-t] |
| 59 | * where, -c n : Run n copies concurrently. |
| 60 | * -e : Turn on errno logging. |
| 61 | * -f : Turn off functionality Testing. |
| 62 | * -i n : Execute test n times. |
| 63 | * -I x : Execute test for x seconds. |
| 64 | * -P x : Pause for x seconds between iterations. |
| 65 | * -t : Turn on syscall timing. |
| 66 | * |
| 67 | * History |
| 68 | * 07/2001 John George |
| 69 | * -Ported |
| 70 | * |
| 71 | * Restrictions: |
| 72 | * This test should be run by root only. |
plars | 5a35166 | 2001-08-31 20:01:52 +0000 | [diff] [blame] | 73 | * nobody and bin must be valid users. |
subrata_modak | 4bb656a | 2009-02-26 12:02:09 +0000 | [diff] [blame] | 74 | * |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 75 | */ |
| 76 | |
| 77 | #include <errno.h> |
| 78 | #include <fcntl.h> |
| 79 | #include <pwd.h> |
| 80 | #include <signal.h> |
| 81 | #include <stdio.h> |
| 82 | #include <stdlib.h> |
| 83 | #include <string.h> |
| 84 | #include <unistd.h> |
| 85 | #include <utime.h> |
| 86 | #include <wait.h> |
| 87 | #include <sys/stat.h> |
| 88 | #include <sys/types.h> |
plars | 74948ad | 2002-11-14 16:16:14 +0000 | [diff] [blame] | 89 | #include <time.h> |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 90 | |
| 91 | #include "test.h" |
Cyril Hrubis | 0f0e348 | 2014-02-27 16:08:04 +0100 | [diff] [blame] | 92 | #include "tst_fs_type.h" |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 93 | |
| 94 | #define TEMP_FILE "tmp_file" |
| 95 | #define FILE_MODE S_IRWXU | S_IRGRP | S_IWGRP| S_IROTH | S_IWOTH |
| 96 | #define LTPUSER1 "nobody" |
plars | 5a35166 | 2001-08-31 20:01:52 +0000 | [diff] [blame] | 97 | #define LTPUSER2 "bin" |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 98 | |
Cyril Hrubis | fdce7d5 | 2013-04-04 18:35:48 +0200 | [diff] [blame] | 99 | char *TCID = "utime03"; |
| 100 | int TST_TOTAL = 1; |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 101 | time_t curr_time; /* current time in seconds */ |
Cyril Hrubis | 605fa33 | 2015-02-04 13:11:20 +0100 | [diff] [blame] | 102 | time_t tloc; |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 103 | |
subrata_modak | 56207ce | 2009-03-23 13:35:39 +0000 | [diff] [blame] | 104 | struct passwd *ltpuser; /* password struct for ltpusers */ |
| 105 | uid_t user_uid; /* user id of ltpuser */ |
| 106 | gid_t group_gid; /* group id of ltpuser */ |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 107 | int status; |
| 108 | |
| 109 | void setup(); /* Main setup function of test */ |
| 110 | void cleanup(); /* cleanup function for the test */ |
| 111 | |
subrata_modak | 56207ce | 2009-03-23 13:35:39 +0000 | [diff] [blame] | 112 | int main(int ac, char **av) |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 113 | { |
| 114 | struct stat stat_buf; /* struct buffer to hold file info. */ |
Cyril Hrubis | 89af32a | 2012-10-24 16:39:11 +0200 | [diff] [blame] | 115 | int lc; |
Cyril Hrubis | 0f0e348 | 2014-02-27 16:08:04 +0100 | [diff] [blame] | 116 | long type; |
Cyril Hrubis | 0b9589f | 2014-05-27 17:40:33 +0200 | [diff] [blame] | 117 | const char *msg; |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 118 | time_t modf_time, access_time; |
| 119 | time_t pres_time; /* file modification/access/present time */ |
| 120 | pid_t pid; |
subrata_modak | 56207ce | 2009-03-23 13:35:39 +0000 | [diff] [blame] | 121 | |
Garrett Cooper | 45e285d | 2010-11-22 12:19:25 -0800 | [diff] [blame] | 122 | msg = parse_opts(ac, av, NULL, NULL); |
| 123 | if (msg != NULL) { |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 124 | tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); |
Garrett Cooper | 2c28215 | 2010-12-16 00:55:50 -0800 | [diff] [blame] | 125 | |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 126 | } |
| 127 | |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 128 | setup(); |
| 129 | |
Cyril Hrubis | 0f0e348 | 2014-02-27 16:08:04 +0100 | [diff] [blame] | 130 | switch ((type = tst_fs_type(cleanup, "."))) { |
| 131 | case TST_NFS_MAGIC: |
Xiong Zhou | d623e2c | 2014-09-25 03:24:19 -0400 | [diff] [blame] | 132 | if (tst_kvercmp(2, 6, 18) < 0) |
| 133 | tst_brkm(TCONF, cleanup, "Cannot do utime on a file" |
| 134 | " on %s filesystem before 2.6.18", |
| 135 | tst_fs_type_name(type)); |
| 136 | break; |
Cyril Hrubis | 0f0e348 | 2014-02-27 16:08:04 +0100 | [diff] [blame] | 137 | case TST_V9FS_MAGIC: |
subrata_modak | 56207ce | 2009-03-23 13:35:39 +0000 | [diff] [blame] | 138 | tst_brkm(TCONF, cleanup, |
Cyril Hrubis | 0f0e348 | 2014-02-27 16:08:04 +0100 | [diff] [blame] | 139 | "Cannot do utime on a file on %s filesystem", |
| 140 | tst_fs_type_name(type)); |
Xiong Zhou | d623e2c | 2014-09-25 03:24:19 -0400 | [diff] [blame] | 141 | break; |
Wanlong Gao | 354ebb4 | 2012-12-07 10:10:04 +0800 | [diff] [blame] | 142 | } |
Cyril Hrubis | bc5da68 | 2011-02-24 20:04:44 +0100 | [diff] [blame] | 143 | |
robbiew | d34d581 | 2005-07-11 22:28:09 +0000 | [diff] [blame] | 144 | pid = FORK_OR_VFORK(); |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 145 | |
| 146 | if (pid == -1) { |
| 147 | tst_brkm(TBROK, cleanup, "fork() failed"); |
| 148 | } else if (pid == 0) { |
| 149 | if ((ltpuser = getpwnam(LTPUSER1)) == NULL) { |
subrata_modak | 56207ce | 2009-03-23 13:35:39 +0000 | [diff] [blame] | 150 | tst_brkm(TBROK, cleanup, "%s not found in /etc/passwd", |
| 151 | LTPUSER1); |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 152 | } |
| 153 | |
| 154 | /* get uid/gid of user accordingly */ |
| 155 | user_uid = ltpuser->pw_uid; |
| 156 | |
| 157 | seteuid(user_uid); |
| 158 | |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 159 | for (lc = 0; TEST_LOOPING(lc); lc++) { |
Garrett Cooper | 2c28215 | 2010-12-16 00:55:50 -0800 | [diff] [blame] | 160 | |
Caspar Zhang | d59a659 | 2013-03-07 14:59:12 +0800 | [diff] [blame] | 161 | tst_count = 0; |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 162 | |
subrata_modak | 4bb656a | 2009-02-26 12:02:09 +0000 | [diff] [blame] | 163 | /* |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 164 | * Invoke utime(2) to set TEMP_FILE access and |
| 165 | * modification times to the current time. |
| 166 | */ |
| 167 | TEST(utime(TEMP_FILE, NULL)); |
| 168 | |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 169 | if (TEST_RETURN == -1) { |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 170 | tst_resm(TFAIL, |
subrata_modak | 56207ce | 2009-03-23 13:35:39 +0000 | [diff] [blame] | 171 | "utime(%s) Failed, errno=%d : %s", |
| 172 | TEMP_FILE, TEST_ERRNO, |
| 173 | strerror(TEST_ERRNO)); |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 174 | } else { |
| 175 | /* |
Cyril Hrubis | e38b961 | 2014-06-02 17:20:57 +0200 | [diff] [blame] | 176 | * Sleep for a second so that mod time |
| 177 | * and access times will be different |
| 178 | * from the current time. |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 179 | */ |
Cyril Hrubis | e38b961 | 2014-06-02 17:20:57 +0200 | [diff] [blame] | 180 | sleep(2); |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 181 | |
Cyril Hrubis | e38b961 | 2014-06-02 17:20:57 +0200 | [diff] [blame] | 182 | /* |
| 183 | * Get the current time now, after |
| 184 | * calling utime(2) |
| 185 | */ |
| 186 | if ((pres_time = time(&tloc)) < 0) { |
| 187 | tst_brkm(TFAIL, cleanup, |
| 188 | "time() failed to get " |
| 189 | "present time after " |
| 190 | "utime, error=%d", |
| 191 | errno); |
| 192 | } |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 193 | |
Cyril Hrubis | e38b961 | 2014-06-02 17:20:57 +0200 | [diff] [blame] | 194 | /* |
| 195 | * Get the modification and access |
| 196 | * times of temporary file using |
| 197 | * stat(2). |
| 198 | */ |
| 199 | if (stat(TEMP_FILE, &stat_buf) < 0) { |
| 200 | tst_brkm(TFAIL, cleanup, |
| 201 | "stat(2) of %s failed, " |
| 202 | "error:%d", TEMP_FILE, |
| 203 | TEST_ERRNO); |
| 204 | } |
| 205 | modf_time = stat_buf.st_mtime; |
| 206 | access_time = stat_buf.st_atime; |
subrata_modak | bdbaec5 | 2009-02-26 12:14:51 +0000 | [diff] [blame] | 207 | |
Cyril Hrubis | e38b961 | 2014-06-02 17:20:57 +0200 | [diff] [blame] | 208 | /* Now do the actual verification */ |
| 209 | if (modf_time <= curr_time || |
| 210 | modf_time >= pres_time || |
| 211 | access_time <= curr_time || |
| 212 | access_time >= pres_time) { |
| 213 | tst_resm(TFAIL, "%s access and " |
| 214 | "modification times " |
| 215 | "not set", TEMP_FILE); |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 216 | } else { |
Cyril Hrubis | e38b961 | 2014-06-02 17:20:57 +0200 | [diff] [blame] | 217 | tst_resm(TPASS, "Functionality " |
| 218 | "of utime(%s, NULL) " |
| 219 | "successful", |
| 220 | TEMP_FILE); |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 221 | } |
| 222 | } |
Caspar Zhang | d59a659 | 2013-03-07 14:59:12 +0800 | [diff] [blame] | 223 | tst_count++; /* incr. TEST_LOOP counter */ |
Garrett Cooper | 2c28215 | 2010-12-16 00:55:50 -0800 | [diff] [blame] | 224 | } |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 225 | } else { |
| 226 | waitpid(pid, &status, 0); |
| 227 | _exit(0); /* |
| 228 | * Exit here and let the child clean up. |
| 229 | * This allows the errno information set |
| 230 | * by the TEST_ERROR_LOG macro and the |
| 231 | * PASS/FAIL status to be preserved for |
| 232 | * use during cleanup. |
| 233 | */ |
| 234 | } |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 235 | |
Garrett Cooper | 2c28215 | 2010-12-16 00:55:50 -0800 | [diff] [blame] | 236 | cleanup(); |
Garrett Cooper | 1e6f5a6 | 2010-12-19 09:58:10 -0800 | [diff] [blame] | 237 | tst_exit(); |
Garrett Cooper | 2c28215 | 2010-12-16 00:55:50 -0800 | [diff] [blame] | 238 | |
| 239 | } |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 240 | |
| 241 | /* |
| 242 | * void |
| 243 | * setup() - performs all ONE TIME setup for this test. |
| 244 | * Create a temporary directory and change directory to it. |
| 245 | * Create a test file under temporary directory and close it |
plars | 5a35166 | 2001-08-31 20:01:52 +0000 | [diff] [blame] | 246 | * Change the ownership of testfile to that of "bin" user. |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 247 | * Record the current time. |
| 248 | */ |
Mike Frysinger | c57fba5 | 2014-04-09 18:56:30 -0400 | [diff] [blame] | 249 | void setup(void) |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 250 | { |
subrata_modak | 56207ce | 2009-03-23 13:35:39 +0000 | [diff] [blame] | 251 | int fildes; /* file handle for temp file */ |
plars | 5a35166 | 2001-08-31 20:01:52 +0000 | [diff] [blame] | 252 | char *tmpd = NULL; |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 253 | |
Nicolas Joly | d4ceb37 | 2014-06-22 17:03:57 +0200 | [diff] [blame] | 254 | tst_require_root(NULL); |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 255 | |
Nicolas Joly | d4ceb37 | 2014-06-22 17:03:57 +0200 | [diff] [blame] | 256 | tst_sig(FORK, DEF_HANDLER, cleanup); |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 257 | |
| 258 | /* Pause if that option was specified |
| 259 | * TEST_PAUSE contains the code to fork the test with the -i option. |
| 260 | * You want to make sure you do this before you create your temporary |
| 261 | * directory. |
| 262 | */ |
| 263 | TEST_PAUSE; |
| 264 | |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 265 | tst_tmpdir(); |
| 266 | |
subrata_modak | 56207ce | 2009-03-23 13:35:39 +0000 | [diff] [blame] | 267 | /* get the name of the temporary directory */ |
| 268 | if ((tmpd = getcwd(tmpd, 0)) == NULL) { |
Garrett Cooper | 5374050 | 2010-12-16 00:04:01 -0800 | [diff] [blame] | 269 | tst_brkm(TBROK, NULL, "getcwd failed"); |
subrata_modak | 56207ce | 2009-03-23 13:35:39 +0000 | [diff] [blame] | 270 | } |
plars | 5a35166 | 2001-08-31 20:01:52 +0000 | [diff] [blame] | 271 | |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 272 | /* Creat a temporary file under above directory */ |
| 273 | if ((fildes = creat(TEMP_FILE, FILE_MODE)) == -1) { |
| 274 | tst_brkm(TBROK, cleanup, |
| 275 | "creat(%s, %#o) Failed, errno=%d :%s", |
| 276 | TEMP_FILE, FILE_MODE, errno, strerror(errno)); |
Wanlong Gao | 354ebb4 | 2012-12-07 10:10:04 +0800 | [diff] [blame] | 277 | } |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 278 | |
| 279 | /* Close the temporary file created */ |
| 280 | if (close(fildes) < 0) { |
| 281 | tst_brkm(TBROK, cleanup, |
| 282 | "close(%s) Failed, errno=%d : %s:", |
| 283 | TEMP_FILE, errno, strerror(errno)); |
Wanlong Gao | 354ebb4 | 2012-12-07 10:10:04 +0800 | [diff] [blame] | 284 | } |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 285 | |
| 286 | /* |
| 287 | * Make sure that specified Mode permissions set as |
| 288 | * umask value may be different. |
| 289 | */ |
| 290 | if (chmod(TEMP_FILE, FILE_MODE) < 0) { |
| 291 | tst_brkm(TBROK, cleanup, |
| 292 | "chmod(%s) Failed, errno=%d : %s:", |
| 293 | TEMP_FILE, errno, strerror(errno)); |
Wanlong Gao | 354ebb4 | 2012-12-07 10:10:04 +0800 | [diff] [blame] | 294 | } |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 295 | |
subrata_modak | 56207ce | 2009-03-23 13:35:39 +0000 | [diff] [blame] | 296 | if (chmod(tmpd, 0711) != 0) { |
| 297 | tst_brkm(TBROK, cleanup, "chmod() failed"); |
| 298 | } |
plars | 5a35166 | 2001-08-31 20:01:52 +0000 | [diff] [blame] | 299 | |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 300 | if ((ltpuser = getpwnam(LTPUSER2)) == NULL) { |
vapier | cff4af0 | 2006-02-11 04:46:30 +0000 | [diff] [blame] | 301 | tst_brkm(TBROK, cleanup, "%s not found in /etc/passwd", |
subrata_modak | 56207ce | 2009-03-23 13:35:39 +0000 | [diff] [blame] | 302 | LTPUSER2); |
Wanlong Gao | 354ebb4 | 2012-12-07 10:10:04 +0800 | [diff] [blame] | 303 | } |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 304 | |
| 305 | /* get uid/gid of user accordingly */ |
| 306 | user_uid = ltpuser->pw_uid; |
| 307 | group_gid = ltpuser->pw_gid; |
| 308 | |
subrata_modak | 56207ce | 2009-03-23 13:35:39 +0000 | [diff] [blame] | 309 | /* |
| 310 | * Change the ownership of test directory/file specified by |
| 311 | * pathname to that of user_uid and group_gid. |
| 312 | */ |
| 313 | if (chown(TEMP_FILE, user_uid, group_gid) < 0) { |
vapier | cff4af0 | 2006-02-11 04:46:30 +0000 | [diff] [blame] | 314 | tst_brkm(TBROK, cleanup, "chown() of %s failed, error %d", |
subrata_modak | 56207ce | 2009-03-23 13:35:39 +0000 | [diff] [blame] | 315 | TEMP_FILE, errno); |
Wanlong Gao | 354ebb4 | 2012-12-07 10:10:04 +0800 | [diff] [blame] | 316 | } |
subrata_modak | 56207ce | 2009-03-23 13:35:39 +0000 | [diff] [blame] | 317 | |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 318 | /* Get the current time */ |
| 319 | if ((curr_time = time(&tloc)) < 0) { |
| 320 | tst_brkm(TBROK, cleanup, |
| 321 | "time() failed to get current time, errno=%d", errno); |
Wanlong Gao | 354ebb4 | 2012-12-07 10:10:04 +0800 | [diff] [blame] | 322 | } |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 323 | |
| 324 | /* |
| 325 | * Sleep for a second so that mod time and access times will be |
| 326 | * different from the current time |
| 327 | */ |
subrata_modak | 56207ce | 2009-03-23 13:35:39 +0000 | [diff] [blame] | 328 | sleep(2); /* sleep(1) on IA64 sometimes sleeps < 1 sec!! */ |
| 329 | |
Garrett Cooper | 2c28215 | 2010-12-16 00:55:50 -0800 | [diff] [blame] | 330 | } |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 331 | |
| 332 | /* |
| 333 | * void |
| 334 | * cleanup() - performs all ONE TIME cleanup for this test at |
| 335 | * completion or premature exit. |
| 336 | * Remove the test directory and testfile created in the setup. |
| 337 | */ |
Mike Frysinger | c57fba5 | 2014-04-09 18:56:30 -0400 | [diff] [blame] | 338 | void cleanup(void) |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 339 | { |
| 340 | seteuid(0); |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 341 | |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 342 | tst_rmdir(); |
| 343 | |
Chris Dearman | ec6edca | 2012-10-17 19:54:01 -0700 | [diff] [blame] | 344 | } |