"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "lib/utils_devpath.c" between
cryptsetup-2.3.6.tar.xz and cryptsetup-2.4.0.tar.xz

About: cryptsetup is a utility used to conveniently setup disk encryption based on the dm-crypt kernel module. These include plain dm-crypt volumes, LUKS volumes, loop-AES and TrueCrypt compatible format.

utils_devpath.c  (cryptsetup-2.3.6.tar.xz):utils_devpath.c  (cryptsetup-2.4.0.tar.xz)
skipping to change at line 411 skipping to change at line 411
r = 1; r = 1;
break; break;
} }
} }
closedir(dir); closedir(dir);
return r; return r;
} }
int lookup_by_sysfs_uuid_field(const char *dm_uuid, size_t max_len) int lookup_by_sysfs_uuid_field(const char *dm_uuid)
{ {
struct dirent *entry; struct dirent *entry;
char subpath[PATH_MAX], uuid[max_len]; char subpath[PATH_MAX], uuid[DM_UUID_LEN];
ssize_t s; ssize_t s;
struct stat st; struct stat st;
int fd, len, r = 0; /* not found */ int fd, len, r = 0; /* not found */
DIR *dir = opendir("/sys/block/"); DIR *dir = opendir("/sys/block/");
if (!dir) if (!dir)
/* map ENOTDIR to ENOENT we'll handle both errors same */ /* map ENOTDIR to ENOENT we'll handle both errors same */
return errno == ENOTDIR ? -ENOENT : -errno; return errno == ENOTDIR ? -ENOENT : -errno;
while (r != 1 && (entry = readdir(dir))) { while (r != 1 && (entry = readdir(dir))) {
skipping to change at line 446 skipping to change at line 446
fd = openat(dirfd(dir), subpath, O_RDONLY | O_CLOEXEC); fd = openat(dirfd(dir), subpath, O_RDONLY | O_CLOEXEC);
if (fd < 0) if (fd < 0)
continue; continue;
if (fstat(fd, &st) || !S_ISREG(st.st_mode)) { if (fstat(fd, &st) || !S_ISREG(st.st_mode)) {
close(fd); close(fd);
continue; continue;
} }
/* reads binary data */ /* reads binary data */
s = read_buffer(fd, uuid, max_len - 1); s = read_buffer(fd, uuid, sizeof(uuid) - 1);
if (s > 0) { if (s > 0) {
uuid[s] = '\0'; uuid[s] = '\0';
if (!strncmp(uuid, dm_uuid, strlen(dm_uuid))) if (!strncmp(uuid, dm_uuid, strlen(dm_uuid)))
r = 1; r = 1;
} }
close(fd); close(fd);
} }
closedir(dir); closedir(dir);
 End of changes. 3 change blocks. 
3 lines changed or deleted 3 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)