anaconda: Remove unused variables to let compile with -Werror=unused-but-set-variable

release2
Marek Marczykowski 13 years ago
parent f32b11be24
commit 3341ed2c5f

@ -222,7 +222,6 @@ static UINTN analyze(VOID)
UINTN i, k, iter, count_active, detected_parttype;
CHARN *fsname;
UINT64 min_start_lba;
UINTN status;
BOOLEAN have_esp;
new_mbr_part_count = 0;
@ -237,7 +236,7 @@ static UINTN analyze(VOID)
gpt_parts[i].mbr_type = gpt_parts[i].gpt_parttype->mbr_type;
if (gpt_parts[i].gpt_parttype->kind == GPT_KIND_BASIC_DATA) {
// Basic Data: need to look at data in the partition
status = detect_mbrtype_fs(gpt_parts[i].start_lba, &detected_parttype, &fsname);
detect_mbrtype_fs(gpt_parts[i].start_lba, &detected_parttype, &fsname);
if (detected_parttype)
gpt_parts[i].mbr_type = detected_parttype;
else
@ -245,7 +244,7 @@ static UINTN analyze(VOID)
} else if (gpt_parts[i].mbr_type == 0xef) {
// EFI System Partition: GNU parted can put this on any partition,
// need to detect file systems
status = detect_mbrtype_fs(gpt_parts[i].start_lba, &detected_parttype, &fsname);
detect_mbrtype_fs(gpt_parts[i].start_lba, &detected_parttype, &fsname);
if (!have_esp && (detected_parttype == 0x01 || detected_parttype == 0x0e || detected_parttype == 0x0c))
; // seems to be a legitimate ESP, don't change
else if (detected_parttype)

@ -185,7 +185,6 @@ int main(int argc, char *argv[])
char *filename;
struct stat sb;
int filekind;
UINT64 filesize;
char *reason;
int status;
@ -207,10 +206,9 @@ int main(int argc, char *argv[])
}
filekind = 0;
filesize = 0;
reason = NULL;
if (S_ISREG(sb.st_mode))
filesize = sb.st_size;
filekind = 0;
else if (S_ISBLK(sb.st_mode))
filekind = 1;
else if (S_ISCHR(sb.st_mode))

@ -149,7 +149,7 @@ static int mapBiosDisks(struct device** devices,const char *path) {
char * sigFileName;
uint32_t mbrSig, biosNum, currentSig;
struct device **currentDev, **foundDisk;
int i, rc, ret, dm_nr, highest_dm;
int i, rc, dm_nr, highest_dm;
dirHandle = opendir(path);
if(!dirHandle){
@ -173,7 +173,7 @@ static int mapBiosDisks(struct device** devices,const char *path) {
if(!strncmp(entry->d_name,".",1) || !strncmp(entry->d_name,"..",2)) {
continue;
}
ret = sscanf((entry->d_name+9), "%x", &biosNum);
sscanf((entry->d_name+9), "%x", &biosNum);
sigFileName = malloc(strlen(path) + strlen(entry->d_name) + 20);
sprintf(sigFileName, "%s/%s/%s", path, entry->d_name, SIG_FILE);
@ -332,6 +332,8 @@ char * getBiosDisk(char *biosStr) {
return NULL;
ret = sscanf(biosStr,"%x",&biosNum);
if (!ret)
return NULL;
disk = lookupHashItem(mbrSigToName, biosNum);
if (disk) return disk->diskname;

@ -137,13 +137,12 @@ static inline int padoutfd(struct ourfd * fd, size_t * where, int modulo) {
static int strntoul(const char * str, char ** endptr, int base, int num) {
char * buf, * end;
unsigned long ret;
buf = alloca(num + 1);
strncpy(buf, str, num);
buf[num] = '\0';
ret = strtoul(buf, &end, base);
strtoul(buf, &end, base);
if (*end)
*endptr = (char *)(str + (end - buf)); /* XXX discards const */
else
@ -491,7 +490,6 @@ int myCpioInstallArchive(gzFile stream, struct cpioFileMapping * mappings,
int linkNum = 0;
struct cpioFileMapping * map = NULL;
struct cpioFileMapping needle;
mode_t cpioMode;
int olderr;
struct cpioCallbackInfo cbInfo;
struct hardLink * links = NULL;
@ -523,8 +521,6 @@ int myCpioInstallArchive(gzFile stream, struct cpioFileMapping * mappings,
if (mappings && !map) {
eatBytes(&fd, ch.size);
} else {
cpioMode = ch.mode;
if (map) {
if (map->mapFlags & CPIO_MAP_PATH) {
free(ch.path);

@ -276,7 +276,7 @@ static int loadDriverDisk(struct loaderData_s *loaderData, char *mntpt) {
struct moduleBallLocation * location;
struct stat sb;
static int disknum = 0;
int fd, ret;
int fd;
/* check for new version */
sprintf(file, "%s/rhdd3", mntpt);
@ -288,7 +288,7 @@ static int loadDriverDisk(struct loaderData_s *loaderData, char *mntpt) {
title = malloc(sb.st_size + 1);
fd = open(file, O_RDONLY);
ret = read(fd, title, sb.st_size);
read(fd, title, sb.st_size);
if (title[sb.st_size - 1] == '\n')
sb.st_size--;
title[sb.st_size] = '\0';

@ -121,7 +121,6 @@ static int getManualModuleArgs(struct moduleInfo * mod, gchar *** moduleArgs) {
int chooseManualDriver(int class, struct loaderData_s *loaderData) {
int i, numSorted, num = 0, done = 0;
enum driverMajor type;
struct sortModuleList * sortedOrder;
char giveArgs = ' ';
gchar **moduleArgs = NULL;
@ -131,13 +130,6 @@ int chooseManualDriver(int class, struct loaderData_s *loaderData) {
newtGrid grid, buttons;
struct newtExitStruct es;
if (class == DEVICE_NETWORK)
type = DRIVER_NET;
else if (class == DEVICE_DISK || class == DEVICE_CDROM)
type = DRIVER_SCSI;
else
type = DRIVER_ANY;
do {
sortedOrder = malloc(sizeof(*sortedOrder) * modInfo->numModules);
numSorted = 0;

@ -80,7 +80,7 @@ static inline int set_fd_coe(int fd, int enable)
static int open_uevent_socket(struct fw_loader *fwl)
{
int fd, rc;
int fd;
struct sockaddr_nl sa;
fd = socket(PF_NETLINK, SOCK_DGRAM, NETLINK_KOBJECT_UEVENT);
@ -102,14 +102,14 @@ static int open_uevent_socket(struct fw_loader *fwl)
fd = open("/proc/sys/kernel/hotplug", O_RDWR);
if (fd >= 0) {
rc = ftruncate(fd, 0);
rc = write(fd, "\n", 1);
ftruncate(fd, 0);
write(fd, "\n", 1);
close(fd);
}
fd = open("/sys/class/firmware/timeout", O_RDWR);
if (fd >= 0) {
rc = write(fd, "10", 2);
write(fd, "10", 2);
close(fd);
}
@ -128,7 +128,6 @@ static void kill_hotplug_signal(int signum)
static int daemonize(struct fw_loader *fwl)
{
int fd;
int rc;
signal(SIGTERM, kill_hotplug_signal);
signal(SIGSEGV, loaderSegvHandler);
@ -142,11 +141,11 @@ static int daemonize(struct fw_loader *fwl)
sigemptyset(&fwl->sigmask);
prctl(PR_SET_NAME, "hotplug", 0, 0, 0);
rc = chdir("/");
chdir("/");
fd = open("/proc/self/oom_adj", O_RDWR);
if (fd >= 0) {
rc = write(fd, "-17", 3);
write(fd, "-17", 3);
close(fd);
}
@ -342,7 +341,6 @@ fetcher(char *inpath, int outfd)
size_t inlen;
int count;
int en = 0;
int rc;
errno = 0;
if (access(inpath, F_OK))
@ -352,8 +350,8 @@ fetcher(char *inpath, int outfd)
goto out;
lseek(outfd, 0, SEEK_SET);
rc = ftruncate(outfd, 0);
rc = ftruncate(outfd, inlen);
ftruncate(outfd, 0);
ftruncate(outfd, inlen);
count = 0;
while (count < inlen) {

@ -127,8 +127,7 @@ static void doExit(int result)
}
static void printstr(char * string) {
int ret;
ret = write(1, string, strlen(string));
write(1, string, strlen(string));
}
static void fatal_error(int usePerror) {
@ -143,7 +142,6 @@ static void fatal_error(int usePerror) {
/* sets up and launches syslog */
static void startSyslog(void) {
int conf_fd;
int ret;
char addr[128];
char forwardtcp[] = "*.* @@";
@ -156,9 +154,9 @@ static void startSyslog(void) {
printf("syslog forwarding will not be enabled\n");
sleep(5);
} else {
ret = write(conf_fd, forwardtcp, strlen(forwardtcp));
ret = write(conf_fd, addr, strlen(addr));
ret = write(conf_fd, "\n", 1);
write(conf_fd, forwardtcp, strlen(forwardtcp));
write(conf_fd, addr, strlen(addr));
write(conf_fd, "\n", 1);
close(conf_fd);
}
}
@ -365,7 +363,7 @@ static void getSyslog(char *addr) {
}
static int getInitPid(void) {
int fd = 0, pid = -1, ret;
int fd = 0, pid = -1;
char * buf = calloc(1, 10);
fd = open("/var/run/init.pid", O_RDONLY);
@ -373,9 +371,9 @@ static int getInitPid(void) {
fprintf(stderr, "Unable to find pid of init!!!\n");
return -1;
}
ret = read(fd, buf, 9);
read(fd, buf, 9);
close(fd);
ret = sscanf(buf, "%d", &pid);
sscanf(buf, "%d", &pid);
return pid;
}
@ -658,11 +656,10 @@ int main(int argc, char **argv) {
tcsetattr(0, TCSANOW, &ts);
}
int ret;
ret = sethostname("localhost.localdomain", 21);
sethostname("localhost.localdomain", 21);
/* the default domainname (as of 2.0.35) is "(none)", which confuses
glibc */
ret = setdomainname("", 0);
setdomainname("", 0);
printf("trying to remount root filesystem read write... ");
if (mount("/", "/", "ext2", MS_REMOUNT | MS_MGC_VAL, NULL)) {
@ -691,10 +688,9 @@ int main(int argc, char **argv) {
/* write out a pid file */
if ((fd = open("/var/run/init.pid", O_WRONLY|O_CREAT, 0644)) > 0) {
char * buf = malloc(10);
int ret;
snprintf(buf, 9, "%d", getpid());
ret = write(fd, buf, strlen(buf));
write(fd, buf, strlen(buf));
close(fd);
free(buf);
} else {
@ -759,9 +755,8 @@ int main(int argc, char **argv) {
ctrl-alt-del handler */
if (count == strlen(buf) &&
(fd = open("/proc/sys/kernel/ctrl-alt-del", O_WRONLY)) != -1) {
int ret;
ret = write(fd, "0", 1);
write(fd, "0", 1);
close(fd);
}
}

@ -1660,7 +1660,6 @@ static int manualDeviceCheck(struct loaderData_s *loaderData) {
* with a '/' */
static void migrate_runtime_directory(char * dirname) {
char * runtimedir;
int ret;
checked_asprintf(&runtimedir, "/mnt/runtime%s", dirname);
@ -1670,10 +1669,10 @@ static void migrate_runtime_directory(char * dirname) {
checked_asprintf(&olddir, "%s_old", dirname);
ret = rename(dirname, olddir);
rename(dirname, olddir);
free(olddir);
}
ret = symlink(runtimedir, dirname);
symlink(runtimedir, dirname);
}
free(runtimedir);
}
@ -1832,7 +1831,7 @@ static void loadScsiDhModules(void)
}
int main(int argc, char ** argv) {
int rc, ret, pid, status;
int rc, pid, status;
struct stat sb;
struct serial_struct si;
@ -2128,7 +2127,7 @@ int main(int argc, char ** argv) {
migrate_runtime_directory("/usr");
migrate_runtime_directory("/lib");
migrate_runtime_directory("/lib64");
ret = symlink("/mnt/runtime/etc/selinux", "/etc/selinux");
symlink("/mnt/runtime/etc/selinux", "/etc/selinux");
copyDirectory("/mnt/runtime/etc","/etc", NULL, copyErrorFn);
copyDirectory("/mnt/runtime/var","/var", NULL, copyErrorFn);
@ -2216,11 +2215,11 @@ int main(int argc, char ** argv) {
if (strncmp(url, "ftp:", 4)) {
*argptr++ = url;
} else {
int fd, ret;
int fd;
fd = open("/tmp/ftp-stage2", O_CREAT | O_TRUNC | O_RDWR, 0600);
ret = write(fd, url, strlen(url));
ret = write(fd, "\r", 1);
write(fd, url, strlen(url));
write(fd, "\r", 1);
close(fd);
*argptr++ = "@/tmp/ftp-stage2";
}
@ -2315,11 +2314,11 @@ int main(int argc, char ** argv) {
if (strncmp(loaderData.instRepo, "ftp:", 4)) {
*argptr++ = loaderData.instRepo;
} else {
int fd, ret;
int fd;
fd = open("/tmp/ftp-repo", O_CREAT | O_TRUNC | O_RDWR, 0600);
ret = write(fd, loaderData.instRepo, strlen(loaderData.instRepo));
ret = write(fd, "\r", 1);
write(fd, loaderData.instRepo, strlen(loaderData.instRepo));
write(fd, "\r", 1);
close(fd);
*argptr++ = "@/tmp/ftp-repo";
}
@ -2331,15 +2330,15 @@ int main(int argc, char ** argv) {
*argptr++ = strdup(loaderData.proxy);
if (loaderData.proxyUser && strcmp(loaderData.proxyUser, "")) {
int fd, ret;
int fd;
fd = open("/tmp/proxy", O_CREAT|O_TRUNC|O_RDWR, 0600);
ret = write(fd, loaderData.proxyUser, strlen(loaderData.proxyUser));
ret = write(fd, "\r\n", 2);
write(fd, loaderData.proxyUser, strlen(loaderData.proxyUser));
write(fd, "\r\n", 2);
if (loaderData.proxyPassword && strcmp(loaderData.proxyPassword, "")) {
ret = write(fd, loaderData.proxyPassword, strlen(loaderData.proxyPassword));
ret = write(fd, "\r\n", 2);
write(fd, loaderData.proxyPassword, strlen(loaderData.proxyPassword));
write(fd, "\r\n", 2);
}
close(fd);

@ -93,7 +93,6 @@ int readModuleInfo(const char * filename, moduleInfoSet mis,
int fd, isIndented;
char * buf, * start, * next = NULL, * chptr;
struct stat sb;
char oldch;
struct moduleInfo * nextModule;
int modulesAlloced;
int i;
@ -223,7 +222,6 @@ int readModuleInfo(const char * filename, moduleInfoSet mis,
chptr = start;
while (!isspace(*chptr) && *chptr) chptr++;
if (*chptr) {
oldch = *chptr;
*chptr = '\0';
nextModule->args[nextModule->numArgs].arg = strdup(start);

@ -363,7 +363,6 @@ void loadKickstartModule(struct loaderData_s * loaderData,
gchar *opts = NULL;
gchar *module = NULL;
gchar **args = NULL, **remaining = NULL;
gboolean rc;
GOptionContext *optCon = g_option_context_new(NULL);
GError *optErr = NULL;
GOptionEntry ksDeviceOptions[] = {
@ -404,7 +403,7 @@ void loadKickstartModule(struct loaderData_s * loaderData,
args = g_strsplit(opts, " ", 0);
}
rc = mlLoadModule(module, args);
mlLoadModule(module, args);
g_strfreev(args);
return;
}

@ -49,7 +49,6 @@ static void performTerminations(void) {
}
static void performUnmounts(void) {
int ignore;
printf("disabling swap...\n");
disableSwap();
@ -58,7 +57,7 @@ static void performUnmounts(void) {
unmountFilesystems();
printf("waiting for mdraid sets to become clean...\n");
ignore = system("/sbin/mdadm --wait-clean --scan");
system("/sbin/mdadm --wait-clean --scan");
}
static void performReboot(reboot_action rebootAction) {

@ -78,31 +78,30 @@ telnet_negotiate(int socket, char ** term_type_ptr, int * heightPtr,
IAC DO NAWS
IAC SB TERMINAL_TYPE "\x01" IAC SE
;
int ret;
ret = write(socket, request, sizeof(request)-1);
write(socket, request, sizeof(request)-1);
/* Read from the terminal until we get the terminal type. This will
do bad things if the client doesn't send the terminal type, but
those clients have existed for aeons (right?) */
do {
ret = read(socket, &ch, 1);
read(socket, &ch, 1);
if (ch != '\xff') {
abort();
}
ret = read(socket, &ch, 1); /* command */
read(socket, &ch, 1); /* command */
if (ch != '\xfa') {
ret = read(socket, &ch, 1); /* verb */
read(socket, &ch, 1); /* verb */
continue;
}
ret = read(socket, &ch, 1); /* suboption */
read(socket, &ch, 1); /* suboption */
if (ch == '\x18') {
state = ST_TERMTYPE;
ret = read(socket, &ch, 1); /* should be 0x0! */
read(socket, &ch, 1); /* should be 0x0! */
done = 1;
} else if (ch == '\x1f') {
state = ST_WINDOWSIZE;
@ -110,7 +109,7 @@ telnet_negotiate(int socket, char ** term_type_ptr, int * heightPtr,
state = ST_NONE;;
}
ret = read(socket, &ch, 1); /* data */
read(socket, &ch, 1); /* data */
while (ch != '\xff') {
if (state == ST_TERMTYPE) {
if (termAlloced == termLength) {
@ -124,10 +123,10 @@ telnet_negotiate(int socket, char ** term_type_ptr, int * heightPtr,
*sizePtr++ = ch;
}
ret = read(socket, &ch, 1); /* data */
read(socket, &ch, 1); /* data */
}
ret = read(socket, &ch, 1); /* should be a SE */
read(socket, &ch, 1); /* should be a SE */
} while (!done);
@ -254,7 +253,6 @@ void
telnet_send_output(int sock, char *data, int len) {
char *s, *d; /* source, destination */
char *buf;
int ret;
buf = alloca((len*2)+1); /* max necessary size */
@ -269,5 +267,5 @@ telnet_send_output(int sock, char *data, int len) {
}
/* now send it... */
ret = write(sock, buf, len);
write(sock, buf, len);
}

@ -169,7 +169,6 @@ int beTelnet(void) {
}
if (fds[1].revents) {
int ret;
i = read(conn, buf, sizeof(buf));
/* connection went away */
@ -177,7 +176,7 @@ int beTelnet(void) {
break;
i = telnet_process_input(&ts, buf, i);
ret = write(masterFd, buf, i);
write(masterFd, buf, i);
#ifdef DEBUG_TELNET
{
int j;

@ -52,9 +52,8 @@ struct unmountInfo {
void undoLoop(struct unmountInfo * fs, int numFs, int this);
static void printstr(char * string) {
int ret;
ret = write(1, string, strlen(string));
write(1, string, strlen(string));
}
void undoMount(struct unmountInfo * fs, int numFs, int this) {
@ -127,7 +126,6 @@ void unmountFilesystems(void) {
int numFilesystems = 0;
int i;
struct loop_info li;
char * device;
struct stat sb;
fd = open("/proc/mounts", O_RDONLY, 0);
@ -145,7 +143,6 @@ void unmountFilesystems(void) {
chptr = buf;
while (*chptr) {
device = chptr;
while (*chptr != ' ') chptr++;
*chptr++ = '\0';
start = chptr;

@ -29,13 +29,13 @@
int main(int argc, char ** argv) {
struct kmapHeader h;
struct kmapInfo info;
int i, x;
int i;
struct stat sb;
char * chptr;
h.magic = KMAP_MAGIC;
h.numEntries = argc - 1;
x = write(1, &h, sizeof(h));
write(1, &h, sizeof(h));
for (i = 1; i < argc; i++) {
if (stat(argv[i], &sb)) {
@ -52,7 +52,7 @@ int main(int argc, char ** argv) {
*chptr = '\0';
info.size = sb.st_size;
x = write(1, &info, sizeof(info));
write(1, &info, sizeof(info));
}
return 0;

@ -262,7 +262,5 @@ getXatom(PyObject *s, PyObject *args)
void
initxutils ()
{
PyObject * d;
d = Py_InitModule ("xutils", xutilsMethods);
Py_InitModule ("xutils", xutilsMethods);
}

Loading…
Cancel
Save