Changeset 2725 in MondoRescue for branches/2.2.9/mindi-busybox/util-linux/ipcrm.c
- Timestamp:
- Feb 25, 2011, 9:26:54 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.2.9/mindi-busybox/util-linux/ipcrm.c
r1765 r2725 6 6 * Adapted for busybox from util-linux-2.12a. 7 7 * 8 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.8 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 9 9 */ 10 10 … … 25 25 int val; 26 26 struct semid_ds *buf; 27 unsigned short int*array;27 unsigned short *array; 28 28 struct seminfo *__buf; 29 29 }; … … 41 41 } type_id; 42 42 43 static int remove_ids(type_id type, int argc,char **argv)43 static int remove_ids(type_id type, char **argv) 44 44 { 45 45 unsigned long id; 46 int ret = 0; /* silence gcc */47 46 int nb_errors = 0; 48 47 union semun arg; … … 50 49 arg.val = 0; 51 50 52 while (arg c) {51 while (argv[0]) { 53 52 id = bb_strtoul(argv[0], NULL, 10); 54 53 if (errno || id > INT_MAX) { … … 56 55 nb_errors++; 57 56 } else { 57 int ret = 0; 58 58 if (type == SEM) 59 59 ret = semctl(id, 0, IPC_RMID, arg); … … 64 64 65 65 if (ret) { 66 bb_perror_msg("can not remove id %s", argv[0]);66 bb_perror_msg("can't remove id %s", argv[0]); 67 67 nb_errors++; 68 68 } 69 69 } 70 argc--;71 70 argv++; 72 71 } … … 77 76 78 77 79 int ipcrm_main(int argc, char **argv) ;78 int ipcrm_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; 80 79 int ipcrm_main(int argc, char **argv) 81 80 { … … 93 92 char w; 94 93 95 w =argv[1][0];94 w = argv[1][0]; 96 95 if ( ((w == 'm' && argv[1][1] == 's' && argv[1][2] == 'g') 97 96 || (argv[1][0] == 's' 98 && ((w =argv[1][1]) == 'h' || w == 'e')97 && ((w = argv[1][1]) == 'h' || w == 'e') 99 98 && argv[1][2] == 'm') 100 99 ) && argv[1][3] == '\0' 101 100 ) { 102 103 101 if (argc < 3) 104 102 bb_show_usage(); … … 111 109 what = SEM; 112 110 113 if (remove_ids(what, argc-2,&argv[2]))114 fflush_stdout_and_exit( 1);111 if (remove_ids(what, &argv[2])) 112 fflush_stdout_and_exit(EXIT_FAILURE); 115 113 printf("resource(s) deleted\n"); 116 114 return 0; … … 123 121 int result; 124 122 int id = 0; 125 int iskey = (isupper)(c);123 int iskey = isupper(c); 126 124 127 125 /* needed to delete semaphores */
Note:
See TracChangeset
for help on using the changeset viewer.