summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile2
-rw-r--r--coreutils/install.c122
-rw-r--r--findutils/find.c6
-rw-r--r--libbb/lineedit.c22
-rw-r--r--loginutils/login.c40
-rw-r--r--networking/httpd.c9
-rw-r--r--runit/runsvdir.c2
-rw-r--r--selinux/chcon.c2
-rw-r--r--selinux/setfiles.c2
-rw-r--r--util-linux/fdisk.c8
10 files changed, 136 insertions, 79 deletions
diff --git a/Makefile b/Makefile
index 5ac88313c..9b9c9c464 100644
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,6 @@
1VERSION = 1 1VERSION = 1
2PATCHLEVEL = 7 2PATCHLEVEL = 7
3SUBLEVEL = 1 3SUBLEVEL = 2
4EXTRAVERSION = 4EXTRAVERSION =
5NAME = Unnamed 5NAME = Unnamed
6 6
diff --git a/coreutils/install.c b/coreutils/install.c
index cf62a0022..516208474 100644
--- a/coreutils/install.c
+++ b/coreutils/install.c
@@ -1,6 +1,6 @@
1/* vi: set sw=4 ts=4: */ 1/* vi: set sw=4 ts=4: */
2/* 2/*
3 * Copyright (C) 2003 by Glenn McGrath <bug1@iinet.net.au> 3 * Copyright (C) 2003 by Glenn McGrath
4 * SELinux support: by Yuichi Nakamura <ynakam@hitachisoft.jp> 4 * SELinux support: by Yuichi Nakamura <ynakam@hitachisoft.jp>
5 * 5 *
6 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 6 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
@@ -23,6 +23,8 @@ static const char install_longopts[] ALIGN1 =
23 "group\0" No_argument "g" 23 "group\0" No_argument "g"
24 "mode\0" No_argument "m" 24 "mode\0" No_argument "m"
25 "owner\0" No_argument "o" 25 "owner\0" No_argument "o"
26/* autofs build insists of using -b --suffix=.orig */
27/* TODO? (short option for --suffix is -S) */
26#if ENABLE_SELINUX 28#if ENABLE_SELINUX
27 "context\0" Required_argument "Z" 29 "context\0" Required_argument "Z"
28 "preserve_context\0" No_argument "\xff" 30 "preserve_context\0" No_argument "\xff"
@@ -33,8 +35,6 @@ static const char install_longopts[] ALIGN1 =
33 35
34 36
35#if ENABLE_SELINUX 37#if ENABLE_SELINUX
36static bool use_default_selinux_context = 1;
37
38static void setdefaultfilecon(const char *path) 38static void setdefaultfilecon(const char *path)
39{ 39{
40 struct stat s; 40 struct stat s;
@@ -73,25 +73,31 @@ int install_main(int argc, char **argv)
73 mode_t mode; 73 mode_t mode;
74 uid_t uid; 74 uid_t uid;
75 gid_t gid; 75 gid_t gid;
76 char *arg, *last;
76 const char *gid_str; 77 const char *gid_str;
77 const char *uid_str; 78 const char *uid_str;
78 const char *mode_str; 79 const char *mode_str;
79 int copy_flags = FILEUTILS_DEREFERENCE | FILEUTILS_FORCE; 80 int copy_flags = FILEUTILS_DEREFERENCE | FILEUTILS_FORCE;
80 int ret = EXIT_SUCCESS, flags, i, isdir; 81 int flags;
82 int ret = EXIT_SUCCESS;
83 int isdir;
81#if ENABLE_SELINUX 84#if ENABLE_SELINUX
82 security_context_t scontext; 85 security_context_t scontext;
86 bool use_default_selinux_context = 1;
83#endif 87#endif
84 enum { 88 enum {
85 OPT_CMD = 0x1, 89 OPT_c = 1 << 0,
86 OPT_DIRECTORY = 0x2, 90 OPT_v = 1 << 1,
87 OPT_PRESERVE_TIME = 0x4, 91 OPT_b = 1 << 2,
88 OPT_STRIP = 0x8, 92 OPT_DIRECTORY = 1 << 3,
89 OPT_GROUP = 0x10, 93 OPT_PRESERVE_TIME = 1 << 4,
90 OPT_MODE = 0x20, 94 OPT_STRIP = 1 << 5,
91 OPT_OWNER = 0x40, 95 OPT_GROUP = 1 << 6,
96 OPT_MODE = 1 << 7,
97 OPT_OWNER = 1 << 8,
92#if ENABLE_SELINUX 98#if ENABLE_SELINUX
93 OPT_SET_SECURITY_CONTEXT = 0x80, 99 OPT_SET_SECURITY_CONTEXT = 1 << 9,
94 OPT_PRESERVE_SECURITY_CONTEXT = 0x100, 100 OPT_PRESERVE_SECURITY_CONTEXT = 1 << 10,
95#endif 101#endif
96 }; 102 };
97 103
@@ -100,21 +106,24 @@ int install_main(int argc, char **argv)
100#endif 106#endif
101 opt_complementary = "s--d:d--s" USE_SELINUX(":Z--\xff:\xff--Z"); 107 opt_complementary = "s--d:d--s" USE_SELINUX(":Z--\xff:\xff--Z");
102 /* -c exists for backwards compatibility, it's needed */ 108 /* -c exists for backwards compatibility, it's needed */
103 109 /* -v is ignored ("print name of each created directory") */
104 flags = getopt32(argv, "cdpsg:m:o:" USE_SELINUX("Z:"), 110 /* -b is ignored ("make a backup of each existing destination file") */
111 flags = getopt32(argv, "cvb" "dpsg:m:o:" USE_SELINUX("Z:"),
105 &gid_str, &mode_str, &uid_str USE_SELINUX(, &scontext)); 112 &gid_str, &mode_str, &uid_str USE_SELINUX(, &scontext));
113 argc -= optind;
114 argv += optind;
106 115
107#if ENABLE_SELINUX 116#if ENABLE_SELINUX
108 if (flags & OPT_PRESERVE_SECURITY_CONTEXT) { 117 if (flags & (OPT_PRESERVE_SECURITY_CONTEXT|OPT_SET_SECURITY_CONTEXT)) {
109 use_default_selinux_context = 0;
110 copy_flags |= FILEUTILS_PRESERVE_SECURITY_CONTEXT;
111 selinux_or_die();
112 }
113 if (flags & OPT_SET_SECURITY_CONTEXT) {
114 selinux_or_die(); 118 selinux_or_die();
115 setfscreatecon_or_die(scontext);
116 use_default_selinux_context = 0; 119 use_default_selinux_context = 0;
117 copy_flags |= FILEUTILS_SET_SECURITY_CONTEXT; 120 if (flags & OPT_PRESERVE_SECURITY_CONTEXT) {
121 copy_flags |= FILEUTILS_PRESERVE_SECURITY_CONTEXT;
122 }
123 if (flags & OPT_SET_SECURITY_CONTEXT) {
124 setfscreatecon_or_die(scontext);
125 copy_flags |= FILEUTILS_SET_SECURITY_CONTEXT;
126 }
118 } 127 }
119#endif 128#endif
120 129
@@ -123,58 +132,63 @@ int install_main(int argc, char **argv)
123 copy_flags |= FILEUTILS_PRESERVE_STATUS; 132 copy_flags |= FILEUTILS_PRESERVE_STATUS;
124 } 133 }
125 mode = 0666; 134 mode = 0666;
126 if (flags & OPT_MODE) bb_parse_mode(mode_str, &mode); 135 if (flags & OPT_MODE)
136 bb_parse_mode(mode_str, &mode);
127 uid = (flags & OPT_OWNER) ? get_ug_id(uid_str, xuname2uid) : getuid(); 137 uid = (flags & OPT_OWNER) ? get_ug_id(uid_str, xuname2uid) : getuid();
128 gid = (flags & OPT_GROUP) ? get_ug_id(gid_str, xgroup2gid) : getgid(); 138 gid = (flags & OPT_GROUP) ? get_ug_id(gid_str, xgroup2gid) : getgid();
129 if (flags & (OPT_OWNER|OPT_GROUP)) umask(0); 139 if (flags & (OPT_OWNER|OPT_GROUP))
140 umask(0);
130 141
131 /* Create directories 142 /* Create directories
132 * don't use bb_make_directory() as it can't change uid or gid 143 * don't use bb_make_directory() as it can't change uid or gid
133 * perhaps bb_make_directory() should be improved. 144 * perhaps bb_make_directory() should be improved.
134 */ 145 */
135 if (flags & OPT_DIRECTORY) { 146 if (flags & OPT_DIRECTORY) {
136 for (argv += optind; *argv; argv++) { 147 while ((arg = *argv++) != NULL) {
137 char *old_argv_ptr = *argv + 1; 148 char *slash = arg;
138 char *argv_ptr; 149 while (1) {
139 do { 150 slash = strchr(slash + 1, '/');
140 argv_ptr = strchr(old_argv_ptr, '/'); 151 if (slash)
141 old_argv_ptr = argv_ptr; 152 *slash = '\0';
142 if (argv_ptr) { 153 if (mkdir(arg, mode | 0111) == -1) {
143 *argv_ptr = '\0';
144 old_argv_ptr++;
145 }
146 if (mkdir(*argv, mode | 0111) == -1) {
147 if (errno != EEXIST) { 154 if (errno != EEXIST) {
148 bb_perror_msg("cannot create %s", *argv); 155 bb_perror_msg("cannot create %s", arg);
149 ret = EXIT_FAILURE; 156 ret = EXIT_FAILURE;
150 break; 157 break;
151 } 158 }
152 } 159 } /* dir was created, chown? */
153 if ((flags & (OPT_OWNER|OPT_GROUP)) 160 else if ((flags & (OPT_OWNER|OPT_GROUP))
154 && lchown(*argv, uid, gid) == -1 161 && lchown(arg, uid, gid) == -1
155 ) { 162 ) {
156 bb_perror_msg("cannot change ownership of %s", *argv); 163 bb_perror_msg("cannot change ownership of %s", arg);
157 ret = EXIT_FAILURE; 164 ret = EXIT_FAILURE;
158 break; 165 break;
159 } 166 }
160 if (argv_ptr) { 167 if (!slash)
161 *argv_ptr = '/'; 168 break;
162 } 169 *slash = '/';
163 } while (old_argv_ptr); 170 }
164 } 171 }
165 return ret; 172 return ret;
166 } 173 }
167 174
168 /* coreutils install resolves link in this case, don't use lstat */ 175 if (argc < 2)
169 isdir = stat(argv[argc - 1], &statbuf) < 0 ? 0 : S_ISDIR(statbuf.st_mode); 176 bb_show_usage();
170 177
171 for (i = optind; i < argc - 1; i++) { 178 last = argv[argc - 1];
172 char *dest; 179 argv[argc - 1] = NULL;
180 /* coreutils install resolves link in this case, don't use lstat */
181 isdir = stat(last, &statbuf) < 0 ? 0 : S_ISDIR(statbuf.st_mode);
173 182
174 dest = argv[argc - 1]; 183 while ((arg = *argv++) != NULL) {
184 char *dest = last;
175 if (isdir) 185 if (isdir)
176 dest = concat_path_file(argv[argc - 1], basename(argv[i])); 186 dest = concat_path_file(last, basename(arg));
177 ret |= copy_file(argv[i], dest, copy_flags); 187 if (copy_file(arg, dest, copy_flags)) {
188 /* copy is not made */
189 ret = EXIT_FAILURE;
190 goto next;
191 }
178 192
179 /* Set the file mode */ 193 /* Set the file mode */
180 if ((flags & OPT_MODE) && chmod(dest, mode) == -1) { 194 if ((flags & OPT_MODE) && chmod(dest, mode) == -1) {
@@ -202,7 +216,9 @@ int install_main(int argc, char **argv)
202 ret = EXIT_FAILURE; 216 ret = EXIT_FAILURE;
203 } 217 }
204 } 218 }
205 if (ENABLE_FEATURE_CLEAN_UP && isdir) free(dest); 219 next:
220 if (ENABLE_FEATURE_CLEAN_UP && isdir)
221 free(dest);
206 } 222 }
207 223
208 return ret; 224 return ret;
diff --git a/findutils/find.c b/findutils/find.c
index 21584681b..f3167a083 100644
--- a/findutils/find.c
+++ b/findutils/find.c
@@ -383,9 +383,11 @@ static int fileAction(const char *fileName, struct stat *statbuf, void *userData
383#if ENABLE_FEATURE_FIND_XDEV 383#if ENABLE_FEATURE_FIND_XDEV
384 if (S_ISDIR(statbuf->st_mode) && xdev_count) { 384 if (S_ISDIR(statbuf->st_mode) && xdev_count) {
385 for (i = 0; i < xdev_count; i++) { 385 for (i = 0; i < xdev_count; i++) {
386 if (xdev_dev[i] != statbuf->st_dev) 386 if (xdev_dev[i] == statbuf->st_dev)
387 return SKIP; 387 break;
388 } 388 }
389 if (i == xdev_count)
390 return SKIP;
389 } 391 }
390#endif 392#endif
391 i = exec_actions(actions, fileName, statbuf); 393 i = exec_actions(actions, fileName, statbuf);
diff --git a/libbb/lineedit.c b/libbb/lineedit.c
index 62f8949d6..f2972e422 100644
--- a/libbb/lineedit.c
+++ b/libbb/lineedit.c
@@ -81,8 +81,9 @@ static int num_ok_lines = 1;
81#endif 81#endif
82 82
83#if ENABLE_FEATURE_GETUSERNAME_AND_HOMEDIR 83#if ENABLE_FEATURE_GETUSERNAME_AND_HOMEDIR
84static char *user_buf = (char*)""; 84static const char null_str[] = "";
85static char *home_pwd_buf = (char*)""; 85static char *user_buf;
86static char *home_pwd_buf = (char*)null_str;
86#endif 87#endif
87 88
88/* Put 'command_ps[cursor]', cursor++. 89/* Put 'command_ps[cursor]', cursor++.
@@ -311,7 +312,7 @@ static void username_tab_completion(char *ud, char *with_shash_flg)
311 312
312 if (with_shash_flg) { /* "~/..." or "~user/..." */ 313 if (with_shash_flg) { /* "~/..." or "~user/..." */
313 char *sav_ud = ud - 1; 314 char *sav_ud = ud - 1;
314 char *home = 0; 315 char *home = NULL;
315 char *temp; 316 char *temp;
316 317
317 if (*ud == '/') { /* "~/..." */ 318 if (*ud == '/') { /* "~/..." */
@@ -1119,7 +1120,7 @@ static void parse_prompt(const char *prmt_ptr)
1119 switch (c) { 1120 switch (c) {
1120#if ENABLE_FEATURE_GETUSERNAME_AND_HOMEDIR 1121#if ENABLE_FEATURE_GETUSERNAME_AND_HOMEDIR
1121 case 'u': 1122 case 'u':
1122 pbuf = user_buf; 1123 pbuf = user_buf ? user_buf : (char*)"";
1123 break; 1124 break;
1124#endif 1125#endif
1125 case 'h': 1126 case 'h':
@@ -1143,7 +1144,7 @@ static void parse_prompt(const char *prmt_ptr)
1143 case 'w': 1144 case 'w':
1144 pbuf = pwd_buf; 1145 pbuf = pwd_buf;
1145 l = strlen(home_pwd_buf); 1146 l = strlen(home_pwd_buf);
1146 if (home_pwd_buf[0] != 0 1147 if (l != 0
1147 && strncmp(home_pwd_buf, pbuf, l) == 0 1148 && strncmp(home_pwd_buf, pbuf, l) == 0
1148 && (pbuf[l]=='/' || pbuf[l]=='\0') 1149 && (pbuf[l]=='/' || pbuf[l]=='\0')
1149 && strlen(pwd_buf+l)<PATH_MAX 1150 && strlen(pwd_buf+l)<PATH_MAX
@@ -1253,6 +1254,11 @@ static void win_changed(int nsig)
1253#undef CTRL 1254#undef CTRL
1254#define CTRL(a) ((a) & ~0x40) 1255#define CTRL(a) ((a) & ~0x40)
1255 1256
1257/* Returns:
1258 * -1 on read errors or EOF, or on bare Ctrl-D.
1259 * 0 on ctrl-C,
1260 * >0 length of input string, including terminating '\n'
1261 */
1256int read_line_input(const char* prompt, char* command, int maxsize, line_input_t *st) 1262int read_line_input(const char* prompt, char* command, int maxsize, line_input_t *st)
1257{ 1263{
1258 int lastWasTab = FALSE; 1264 int lastWasTab = FALSE;
@@ -1305,8 +1311,14 @@ int read_line_input(const char* prompt, char* command, int maxsize, line_input_t
1305 1311
1306 entry = getpwuid(geteuid()); 1312 entry = getpwuid(geteuid());
1307 if (entry) { 1313 if (entry) {
1314 /* If we enter read_line_input for the Nth time,
1315 * they may be already allocated! Need to free. */
1316 free(user_buf);
1317 if (home_pwd_buf != null_str)
1318 free(home_pwd_buf);
1308 user_buf = xstrdup(entry->pw_name); 1319 user_buf = xstrdup(entry->pw_name);
1309 home_pwd_buf = xstrdup(entry->pw_dir); 1320 home_pwd_buf = xstrdup(entry->pw_dir);
1321 /* They are not freed on exit (too small to bother) */
1310 } 1322 }
1311 } 1323 }
1312#endif 1324#endif
diff --git a/loginutils/login.c b/loginutils/login.c
index 3b4cf2af8..7f8907543 100644
--- a/loginutils/login.c
+++ b/loginutils/login.c
@@ -307,18 +307,26 @@ int login_main(int argc, char **argv)
307 goto pam_auth_failed; 307 goto pam_auth_failed;
308 } 308 }
309 pamret = pam_authenticate(pamh, 0); 309 pamret = pam_authenticate(pamh, 0);
310 if (pamret == PAM_SUCCESS) { 310 if (pamret != PAM_SUCCESS) {
311 char *pamuser; 311 failed_msg = "pam_authenticate";
312 /* check that the account is healthy. */ 312 goto pam_auth_failed;
313 pamret = pam_acct_mgmt(pamh, 0); 313 /* TODO: or just "goto auth_failed"
314 if (pamret != PAM_SUCCESS) { 314 * since user seems to enter wrong password
315 failed_msg = "account setup"; 315 * (in this case pamret == 7)
316 goto pam_auth_failed; 316 */
317 } 317 }
318 /* read user back */ 318 /* check that the account is healthy */
319 pamret = pam_acct_mgmt(pamh, 0);
320 if (pamret != PAM_SUCCESS) {
321 failed_msg = "account setup";
322 goto pam_auth_failed;
323 }
324 /* read user back */
325 {
326 const char *pamuser;
319 /* gcc: "dereferencing type-punned pointer breaks aliasing rules..." 327 /* gcc: "dereferencing type-punned pointer breaks aliasing rules..."
320 * thus we use double cast */ 328 * thus we cast to (void*) */
321 if (pam_get_item(pamh, PAM_USER, (const void **)(void*)&pamuser) != PAM_SUCCESS) { 329 if (pam_get_item(pamh, PAM_USER, (void*)&pamuser) != PAM_SUCCESS) {
322 failed_msg = "pam_get_item(USER)"; 330 failed_msg = "pam_get_item(USER)";
323 goto pam_auth_failed; 331 goto pam_auth_failed;
324 } 332 }
@@ -331,7 +339,7 @@ int login_main(int argc, char **argv)
331 break; 339 break;
332 goto auth_failed; 340 goto auth_failed;
333 pam_auth_failed: 341 pam_auth_failed:
334 bb_error_msg("%s failed: %s", failed_msg, pam_strerror(pamh, pamret)); 342 bb_error_msg("%s failed: %s (%d)", failed_msg, pam_strerror(pamh, pamret), pamret);
335 safe_strncpy(username, "UNKNOWN", sizeof(username)); 343 safe_strncpy(username, "UNKNOWN", sizeof(username));
336#else /* not PAM */ 344#else /* not PAM */
337 pw = getpwnam(username); 345 pw = getpwnam(username);
@@ -360,6 +368,7 @@ int login_main(int argc, char **argv)
360 auth_failed: 368 auth_failed:
361 opt &= ~LOGIN_OPT_f; 369 opt &= ~LOGIN_OPT_f;
362 bb_do_delay(FAIL_DELAY); 370 bb_do_delay(FAIL_DELAY);
371 /* TODO: doesn't sound like correct English phrase to me */
363 puts("Login incorrect"); 372 puts("Login incorrect");
364 if (++count == 3) { 373 if (++count == 3) {
365 syslog(LOG_WARNING, "invalid password for '%s'%s", 374 syslog(LOG_WARNING, "invalid password for '%s'%s",
@@ -423,7 +432,9 @@ int login_main(int argc, char **argv)
423 tmp = pw->pw_shell; 432 tmp = pw->pw_shell;
424 if (!tmp || !*tmp) 433 if (!tmp || !*tmp)
425 tmp = DEFAULT_SHELL; 434 tmp = DEFAULT_SHELL;
435 /* setup_environment params: shell, loginshell, changeenv, pw */
426 setup_environment(tmp, 1, !(opt & LOGIN_OPT_p), pw); 436 setup_environment(tmp, 1, !(opt & LOGIN_OPT_p), pw);
437 /* FIXME: login shell = 1 -> 3rd parameter is ignored! */
427 438
428 motd(); 439 motd();
429 440
@@ -454,7 +465,8 @@ int login_main(int argc, char **argv)
454 * should it leave SIGINT etc enabled or disabled? */ 465 * should it leave SIGINT etc enabled or disabled? */
455 signal(SIGINT, SIG_DFL); 466 signal(SIGINT, SIG_DFL);
456 467
457 run_shell(tmp, 1, 0, 0); /* exec the shell finally */ 468 /* Exec login shell with no additional parameters */
469 run_shell(tmp, 1, NULL, NULL);
458 470
459 return EXIT_FAILURE; 471 /* return EXIT_FAILURE; - not reached */
460} 472}
diff --git a/networking/httpd.c b/networking/httpd.c
index a888c2424..e67e6bd64 100644
--- a/networking/httpd.c
+++ b/networking/httpd.c
@@ -598,7 +598,7 @@ static void parse_conf(const char *path, int flag)
598 ++p; /* so keep last character */ 598 ++p; /* so keep last character */
599 } 599 }
600 *p = '\0'; 600 *p = '\0';
601 sprintf(p0, "%s:%s", p0, c); 601 sprintf(p0 + strlen(p0), ":%s", c);
602 } 602 }
603#endif 603#endif
604 604
@@ -1602,6 +1602,13 @@ static void handle_incoming_and_exit(const len_and_sockaddr *fromAddr)
1602 if (fromAddr->sa.sa_family == AF_INET) { 1602 if (fromAddr->sa.sa_family == AF_INET) {
1603 rmt_ip = ntohl(fromAddr->sin.sin_addr.s_addr); 1603 rmt_ip = ntohl(fromAddr->sin.sin_addr.s_addr);
1604 } 1604 }
1605#if ENABLE_FEATURE_IPV6
1606 if (fromAddr->sa.sa_family == AF_INET6
1607 && fromAddr->sin6.sin6_addr.s6_addr32[0] == 0
1608 && fromAddr->sin6.sin6_addr.s6_addr32[1] == 0
1609 && ntohl(fromAddr->sin6.sin6_addr.s6_addr32[2]) == 0xffff)
1610 rmt_ip = ntohl(fromAddr->sin6.sin6_addr.s6_addr32[3]);
1611#endif
1605 if (ENABLE_FEATURE_HTTPD_CGI || DEBUG || verbose) { 1612 if (ENABLE_FEATURE_HTTPD_CGI || DEBUG || verbose) {
1606 rmt_ip_str = xmalloc_sockaddr2dotted(&fromAddr->sa); 1613 rmt_ip_str = xmalloc_sockaddr2dotted(&fromAddr->sa);
1607 } 1614 }
diff --git a/runit/runsvdir.c b/runit/runsvdir.c
index 38da7f8ae..94397bc36 100644
--- a/runit/runsvdir.c
+++ b/runit/runsvdir.c
@@ -300,10 +300,10 @@ int runsvdir_main(int argc, char **argv)
300 stamplog = now + 900; 300 stamplog = now + 900;
301 } 301 }
302 } 302 }
303 deadline = now + (check ? 1 : 5);
304 303
305 pfd[0].revents = 0; 304 pfd[0].revents = 0;
306 sig_block(SIGCHLD); 305 sig_block(SIGCHLD);
306 deadline = (check ? 1 : 5);
307 if (rplog) 307 if (rplog)
308 poll(pfd, 1, deadline*1000); 308 poll(pfd, 1, deadline*1000);
309 else 309 else
diff --git a/selinux/chcon.c b/selinux/chcon.c
index f0590b5b0..3609880cb 100644
--- a/selinux/chcon.c
+++ b/selinux/chcon.c
@@ -136,7 +136,7 @@ int chcon_main(int argc, char **argv)
136 ":\xff--urtl:u--\xff:r--\xff:t--\xff:l--\xff" 136 ":\xff--urtl:u--\xff:r--\xff:t--\xff:l--\xff"
137#endif 137#endif
138 ":f--v:v--f"; /* 'verbose' and 'quiet' are exclusive */ 138 ":f--v:v--f"; /* 'verbose' and 'quiet' are exclusive */
139 getopt32(argv, "Rchf:u:r:t:l:v", 139 getopt32(argv, "Rchfu:r:t:l:v",
140 &user, &role, &type, &range, &reference_file); 140 &user, &role, &type, &range, &reference_file);
141 argv += optind; 141 argv += optind;
142 142
diff --git a/selinux/setfiles.c b/selinux/setfiles.c
index 174d4ce60..c3775cd90 100644
--- a/selinux/setfiles.c
+++ b/selinux/setfiles.c
@@ -189,7 +189,7 @@ static int match(const char *name, struct stat *sb, char **con)
189 file_sep = strrchr(tmp_path, '/'); 189 file_sep = strrchr(tmp_path, '/');
190 if (file_sep == tmp_path) { 190 if (file_sep == tmp_path) {
191 file_sep++; 191 file_sep++;
192 p[0] = '\0'; 192 path[0] = '\0';
193 p = path; 193 p = path;
194 } else if (file_sep) { 194 } else if (file_sep) {
195 *file_sep++ = '\0'; 195 *file_sep++ = '\0';
diff --git a/util-linux/fdisk.c b/util-linux/fdisk.c
index 2a91a8f2f..7981abc9f 100644
--- a/util-linux/fdisk.c
+++ b/util-linux/fdisk.c
@@ -638,8 +638,16 @@ static void
638seek_sector(ullong secno) 638seek_sector(ullong secno)
639{ 639{
640 secno *= sector_size; 640 secno *= sector_size;
641#if ENABLE_FDISK_SUPPORT_LARGE_DISKS
641 if (lseek64(fd, (off64_t)secno, SEEK_SET) == (off64_t) -1) 642 if (lseek64(fd, (off64_t)secno, SEEK_SET) == (off64_t) -1)
642 fdisk_fatal(unable_to_seek); 643 fdisk_fatal(unable_to_seek);
644#else
645 if (secno > MAXINT(off_t)
646 || lseek(fd, (off_t)secno, SEEK_SET) == (off_t) -1
647 ) {
648 fdisk_fatal(unable_to_seek);
649 }
650#endif
643} 651}
644 652
645#if ENABLE_FEATURE_FDISK_WRITABLE 653#if ENABLE_FEATURE_FDISK_WRITABLE