Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F102634024
D47568.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D47568.diff
View Options
diff --git a/bin/mv/mv.c b/bin/mv/mv.c
--- a/bin/mv/mv.c
+++ b/bin/mv/mv.c
@@ -32,13 +32,12 @@
* SUCH DAMAGE.
*/
-#include <sys/types.h>
-#include <sys/acl.h>
#include <sys/param.h>
+#include <sys/acl.h>
+#include <sys/mount.h>
+#include <sys/stat.h>
#include <sys/time.h>
#include <sys/wait.h>
-#include <sys/stat.h>
-#include <sys/mount.h>
#include <err.h>
#include <errno.h>
@@ -62,18 +61,16 @@
static int do_move(const char *, const char *);
static int fastcopy(const char *, const char *, struct stat *);
static void usage(void);
-static void preserve_fd_acls(int source_fd, int dest_fd, const char *source_path,
- const char *dest_path);
+static void preserve_fd_acls(int, int, const char *, const char *);
int
main(int argc, char *argv[])
{
- size_t baselen, len;
- int rval;
- char *p, *endp;
- struct stat sb;
- int ch;
char path[PATH_MAX];
+ struct stat sb;
+ char *p, *endp;
+ size_t baselen, len;
+ int ch, rval;
while ((ch = getopt(argc, argv, "fhinv")) != -1)
switch (ch) {
@@ -161,9 +158,10 @@
static int
do_move(const char *from, const char *to)
{
+ char path[PATH_MAX], modep[15];
+ struct statfs sfs;
struct stat sb;
int ask, ch, first;
- char modep[15];
/*
* Check access. If interactive and file exists, ask user if it
@@ -171,9 +169,8 @@
* make sure the user wants to clobber it.
*/
if (!fflg && !access(to, F_OK)) {
-
/* prompt only if source exists */
- if (lstat(from, &sb) == -1) {
+ if (lstat(from, &sb) == -1) {
warn("%s", from);
return (1);
}
@@ -217,9 +214,6 @@
}
if (errno == EXDEV) {
- struct statfs sfs;
- char path[PATH_MAX];
-
/*
* If the source is a symbolic link and is on another
* filesystem, it can be recreated at the destination.
@@ -305,8 +299,8 @@
warn("%s: set owner/group (was: %lu/%lu)", to,
(u_long)sbp->st_uid, (u_long)sbp->st_gid);
if (oldmode & (S_ISUID | S_ISGID)) {
- warnx(
-"%s: owner/group changed; clearing suid/sgid (mode was 0%03o)",
+ warnx("%s: owner/group changed; "
+ "clearing suid/sgid (mode was 0%03o)",
to, oldmode);
sbp->st_mode &= ~(S_ISUID | S_ISGID);
}
@@ -494,9 +488,8 @@
static void
usage(void)
{
-
(void)fprintf(stderr, "%s\n%s\n",
- "usage: mv [-f | -i | -n] [-hv] source target",
- " mv [-f | -i | -n] [-v] source ... directory");
+ "usage: mv [-f | -i | -n] [-hv] source target",
+ " mv [-f | -i | -n] [-v] source ... directory");
exit(EX_USAGE);
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Nov 16, 2:58 AM (21 h, 1 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
14641375
Default Alt Text
D47568.diff (2 KB)
Attached To
Mode
D47568: mv: More style nits.
Attached
Detach File
Event Timeline
Log In to Comment