* 'fixes' of https://github.com/rudimeier/util-linux:
  wipefs: add missing ifdef
  lib/path: remove unused expression
  ipcs,chmem: fix access() usage
This commit is contained in:
Karel Zak 2018-07-03 13:55:32 +02:00
commit 9c836fde5f
4 changed files with 11 additions and 10 deletions

View File

@ -1039,7 +1039,7 @@ int main(int argc, char *argv[])
while((c = getopt_long(argc, argv, "p:h", longopts, NULL)) != -1) { while((c = getopt_long(argc, argv, "p:h", longopts, NULL)) != -1) {
switch(c) { switch(c) {
case 'p': case 'p':
prefix = optarg, "failed to parse range start"; prefix = optarg;
break; break;
case 'h': case 'h':
usage(); usage();

View File

@ -802,7 +802,6 @@ main(int argc, char **argv)
/* /*
* Erase * Erase
*/ */
size_t i;
ctl.ndevs = argc - optind; ctl.ndevs = argc - optind;
while (optind < argc) { while (optind < argc) {
@ -811,10 +810,11 @@ main(int argc, char **argv)
ctl.ndevs--; ctl.ndevs--;
} }
#ifdef BLKRRPART
/* Re-read partition tables on whole-disk devices. This is /* Re-read partition tables on whole-disk devices. This is
* postponed until all is done to avoid conflicts. * postponed until all is done to avoid conflicts.
*/ */
for (i = 0; i < ctl.nrereads; i++) { for (size_t i = 0; i < ctl.nrereads; i++) {
char *devname = ctl.reread[i]; char *devname = ctl.reread[i];
int fd = open(devname, O_RDONLY); int fd = open(devname, O_RDONLY);
@ -824,6 +824,7 @@ main(int argc, char **argv)
} }
} }
free(ctl.reread); free(ctl.reread);
#endif
} }
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }

View File

@ -428,7 +428,7 @@ int main(int argc, char **argv)
/* The valid_zones sysfs attribute was introduced with kernel 3.18 */ /* The valid_zones sysfs attribute was introduced with kernel 3.18 */
if (ul_path_access(desc->sysmem, F_OK, "memory0/valid_zones")) if (ul_path_access(desc->sysmem, F_OK, "memory0/valid_zones") == 0)
desc->have_zones = 1; desc->have_zones = 1;
else if (zone) else if (zone)
warnx(_("zone ignored, no valid_zones sysfs attribute present")); warnx(_("zone ignored, no valid_zones sysfs attribute present"));

View File

@ -18,9 +18,9 @@
int ipc_msg_get_limits(struct ipc_limits *lim) int ipc_msg_get_limits(struct ipc_limits *lim)
{ {
if (access(_PATH_PROC_IPC_MSGMNI, F_OK) && if (access(_PATH_PROC_IPC_MSGMNI, F_OK) == 0 &&
access(_PATH_PROC_IPC_MSGMNB, F_OK) && access(_PATH_PROC_IPC_MSGMNB, F_OK) == 0 &&
access(_PATH_PROC_IPC_MSGMAX, F_OK)) { access(_PATH_PROC_IPC_MSGMAX, F_OK) == 0) {
ul_path_read_s32(NULL, &lim->msgmni, _PATH_PROC_IPC_MSGMNI); ul_path_read_s32(NULL, &lim->msgmni, _PATH_PROC_IPC_MSGMNI);
ul_path_read_s32(NULL, &lim->msgmnb, _PATH_PROC_IPC_MSGMNB); ul_path_read_s32(NULL, &lim->msgmnb, _PATH_PROC_IPC_MSGMNB);
@ -71,9 +71,9 @@ int ipc_shm_get_limits(struct ipc_limits *lim)
{ {
lim->shmmin = SHMMIN; lim->shmmin = SHMMIN;
if (access(_PATH_PROC_IPC_SHMALL, F_OK) && if (access(_PATH_PROC_IPC_SHMALL, F_OK) == 0 &&
access(_PATH_PROC_IPC_SHMMAX, F_OK) && access(_PATH_PROC_IPC_SHMMAX, F_OK) == 0 &&
access(_PATH_PROC_IPC_SHMMNI, F_OK)) { access(_PATH_PROC_IPC_SHMMNI, F_OK) == 0) {
ul_path_read_u64(NULL, &lim->shmall, _PATH_PROC_IPC_SHMALL); ul_path_read_u64(NULL, &lim->shmall, _PATH_PROC_IPC_SHMALL);
ul_path_read_u64(NULL, &lim->shmmax, _PATH_PROC_IPC_SHMMAX); ul_path_read_u64(NULL, &lim->shmmax, _PATH_PROC_IPC_SHMMAX);