dd: code shrink
[oweals/busybox.git] / util-linux / flock.c
index 77fe1f8091981706a43227b7fbe3723d0df847aa..05a747f724b678a0bc6cfeca032f4f42ad4b2783 100644 (file)
@@ -3,6 +3,16 @@
  *
  * This is free software, licensed under the GNU General Public License v2.
  */
+
+//usage:#define flock_trivial_usage
+//usage:       "[-sxun] FD|{FILE [-c] PROG ARGS}"
+//usage:#define flock_full_usage "\n\n"
+//usage:       "[Un]lock file descriptor, or lock FILE, run PROG\n"
+//usage:     "\n       -s      Shared lock"
+//usage:     "\n       -x      Exclusive lock (default)"
+//usage:     "\n       -u      Unlock FD"
+//usage:     "\n       -n      Fail rather than wait"
+
 #include <sys/file.h>
 #include "libbb.h"
 
@@ -35,7 +45,7 @@ int flock_main(int argc UNUSED_PARAM, char **argv)
        if (argv[1]) {
                fd = open(argv[0], O_RDONLY|O_NOCTTY|O_CREAT, 0666);
                if (fd < 0 && errno == EISDIR)
-                       fd = open(argv[0], O_RDONLY|O_NOCTTY);
+                       fd = open(argv[0], O_RDONLY|O_NOCTTY);
                if (fd < 0)
                        bb_perror_msg_and_die("can't open '%s'", argv[0]);
                //TODO? close_on_exec_on(fd);