Last change
on this file since 2936 was 2725, checked in by Bruno Cornec, 14 years ago |
- Update mindi-busybox to 1.18.3 to avoid problems with the tar command which is now failing on recent versions with busybox 1.7.3
|
-
Property svn:eol-style
set to
native
|
File size:
905 bytes
|
Line | |
---|
1 | /* vi: set sw=4 ts=4: */
|
---|
2 | /*
|
---|
3 | * Mini fsync implementation for busybox
|
---|
4 | *
|
---|
5 | * Copyright (C) 2008 Nokia Corporation. All rights reserved.
|
---|
6 | *
|
---|
7 | * Licensed under GPLv2 or later, see file LICENSE in this source tree.
|
---|
8 | */
|
---|
9 | #include "libbb.h"
|
---|
10 | #ifndef O_NOATIME
|
---|
11 | # define O_NOATIME 0
|
---|
12 | #endif
|
---|
13 |
|
---|
14 | /* This is a NOFORK applet. Be very careful! */
|
---|
15 |
|
---|
16 | int fsync_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
---|
17 | int fsync_main(int argc UNUSED_PARAM, char **argv)
|
---|
18 | {
|
---|
19 | int status;
|
---|
20 | int opts;
|
---|
21 |
|
---|
22 | opts = getopt32(argv, "d"); /* fdatasync */
|
---|
23 | argv += optind;
|
---|
24 | if (!*argv) {
|
---|
25 | bb_show_usage();
|
---|
26 | }
|
---|
27 |
|
---|
28 | status = EXIT_SUCCESS;
|
---|
29 | do {
|
---|
30 | int fd = open_or_warn(*argv, O_NOATIME | O_NOCTTY | O_RDONLY);
|
---|
31 |
|
---|
32 | if (fd == -1) {
|
---|
33 | status = EXIT_FAILURE;
|
---|
34 | continue;
|
---|
35 | }
|
---|
36 | if ((opts ? fdatasync(fd) : fsync(fd))) {
|
---|
37 | //status = EXIT_FAILURE; - do we want this?
|
---|
38 | bb_simple_perror_msg(*argv);
|
---|
39 | }
|
---|
40 | close(fd);
|
---|
41 | } while (*++argv);
|
---|
42 |
|
---|
43 | return status;
|
---|
44 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.