[lxc-devel] [lxc/lxc] a70c9e: utils: Copying source filename to avoid missing info.

Christian Brauner noreply at github.com
Fri Sep 6 07:10:25 UTC 2019


  Branch: refs/heads/master
  Home:   https://github.com/lxc/lxc
  Commit: a70c9e85a6d8ac1b75d6705d2373fd9c7b567240
      https://github.com/lxc/lxc/commit/a70c9e85a6d8ac1b75d6705d2373fd9c7b567240
  Author: Julio Faracco <jcfaracco at gmail.com>
  Date:   2019-09-05 (Thu, 05 Sep 2019)

  Changed paths:
    M src/lxc/utils.c

  Log Message:
  -----------
  utils: Copying source filename to avoid missing info.

Some applications use information from LOOP_GET_STATUS64. The file
associated with loop device is pointed inside structure field
`lo_file_name`. The current code is setting up a loop device without
this information. A legacy example of code checking this is cryptsetup:

    static char *_ioctl_backing_file(const char *loop)
    {
        struct loop_info64 lo64 = {0};
        int loop_fd;

        loop_fd = open(loop, O_RDONLY);
        if (loop_fd < 0)
            return NULL;

        if (ioctl(loop_fd, LOOP_GET_STATUS64, &lo64) < 0) {
            close(loop_fd);
            return NULL;
        }

        lo64.lo_file_name[LO_NAME_SIZE-2] = '*';
        lo64.lo_file_name[LO_NAME_SIZE-1] = 0;

        close(loop_fd);
        return strdup((char*)lo64.lo_file_name);
    }

It will return an empty string because lo_file_name was not set.

Signed-off-by: Julio Faracco <jcfaracco at gmail.com>


  Commit: d62ac985823bc7deb0b8d834a8223adf57c39650
      https://github.com/lxc/lxc/commit/d62ac985823bc7deb0b8d834a8223adf57c39650
  Author: Christian Brauner <christian.brauner at ubuntu.com>
  Date:   2019-09-06 (Fri, 06 Sep 2019)

  Changed paths:
    M src/lxc/utils.c

  Log Message:
  -----------
  Merge pull request #3134 from jcfaracco/loop

utils: Copying source filename to avoid missing info


Compare: https://github.com/lxc/lxc/compare/13a885dd1049...d62ac985823b


More information about the lxc-devel mailing list