- don't free user-supplied string (via -e)
[oweals/busybox.git] / libbb / loop.c
index 9559d429a339294f0e083d9caeda52bf0c5d6949..7d2b420be13123c113b155c1962f2a0c68fd81cf 100644 (file)
@@ -44,7 +44,7 @@ typedef struct {
 } bb_loop_info;
 #endif
 
-char *query_loop(const char *device)
+char* FAST_FUNC query_loop(const char *device)
 {
        int fd;
        bb_loop_info loopinfo;
@@ -61,7 +61,7 @@ char *query_loop(const char *device)
 }
 
 
-int del_loop(const char *device)
+int FAST_FUNC del_loop(const char *device)
 {
        int fd, rc;
 
@@ -79,9 +79,10 @@ int del_loop(const char *device)
    search will re-use an existing loop device already bound to that
    file/offset if it finds one.
  */
-int set_loop(char **device, const char *file, unsigned long long offset)
+int FAST_FUNC set_loop(char **device, const char *file, unsigned long long offset)
 {
-       char dev[20], *try;
+       char dev[LOOP_NAMESIZE];
+       char *try;
        bb_loop_info loopinfo;
        struct stat statbuf;
        int i, dfd, ffd, mode, rc = -1;
@@ -140,14 +141,14 @@ int set_loop(char **device, const char *file, unsigned long long offset)
                        rc = -1;
                }
                close(dfd);
-try_again:
+ try_again:
                if (*device) break;
        }
        close(ffd);
        if (!rc) {
                if (!*device)
                        *device = xstrdup(dev);
-               return (mode == O_RDONLY) ? 1 : 0;
+               return (mode == O_RDONLY); /* 1:ro, 0:rw */
        }
        return rc;
 }