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

This reverts commit 3341ed2c5f.

This commit breaks build on F13...
This commit is contained in:
Joanna Rutkowska 2011-07-02 15:05:18 +02:00
parent cce46d2328
commit ebd88386f9
17 changed files with 95 additions and 62 deletions

View File

@ -222,6 +222,7 @@ 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;
@ -236,7 +237,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
detect_mbrtype_fs(gpt_parts[i].start_lba, &detected_parttype, &fsname);
status = detect_mbrtype_fs(gpt_parts[i].start_lba, &detected_parttype, &fsname);
if (detected_parttype)
gpt_parts[i].mbr_type = detected_parttype;
else
@ -244,7 +245,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
detect_mbrtype_fs(gpt_parts[i].start_lba, &detected_parttype, &fsname);
status = 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)

View File

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

View File

@ -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, dm_nr, highest_dm;
int i, rc, ret, 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;
}
sscanf((entry->d_name+9), "%x", &biosNum);
ret = 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,8 +332,6 @@ char * getBiosDisk(char *biosStr) {
return NULL;
ret = sscanf(biosStr,"%x",&biosNum);
if (!ret)
return NULL;
disk = lookupHashItem(mbrSigToName, biosNum);
if (disk) return disk->diskname;

View File

@ -137,12 +137,13 @@ 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';
strtoul(buf, &end, base);
ret = strtoul(buf, &end, base);
if (*end)
*endptr = (char *)(str + (end - buf)); /* XXX discards const */
else
@ -490,6 +491,7 @@ 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;
@ -521,6 +523,8 @@ 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);

View File

@ -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;
int fd, ret;
/* 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);
read(fd, title, sb.st_size);
ret = read(fd, title, sb.st_size);
if (title[sb.st_size - 1] == '\n')
sb.st_size--;
title[sb.st_size] = '\0';

View File

@ -121,6 +121,7 @@ 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;
@ -130,6 +131,13 @@ 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;

View File

@ -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;
int fd, rc;
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) {
ftruncate(fd, 0);
write(fd, "\n", 1);
rc = ftruncate(fd, 0);
rc = write(fd, "\n", 1);
close(fd);
}
fd = open("/sys/class/firmware/timeout", O_RDWR);
if (fd >= 0) {
write(fd, "10", 2);
rc = write(fd, "10", 2);
close(fd);
}
@ -128,6 +128,7 @@ 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);
@ -141,11 +142,11 @@ static int daemonize(struct fw_loader *fwl)
sigemptyset(&fwl->sigmask);
prctl(PR_SET_NAME, "hotplug", 0, 0, 0);
chdir("/");
rc = chdir("/");
fd = open("/proc/self/oom_adj", O_RDWR);
if (fd >= 0) {
write(fd, "-17", 3);
rc = write(fd, "-17", 3);
close(fd);
}
@ -341,6 +342,7 @@ fetcher(char *inpath, int outfd)
size_t inlen;
int count;
int en = 0;
int rc;
errno = 0;
if (access(inpath, F_OK))
@ -350,8 +352,8 @@ fetcher(char *inpath, int outfd)
goto out;
lseek(outfd, 0, SEEK_SET);
ftruncate(outfd, 0);
ftruncate(outfd, inlen);
rc = ftruncate(outfd, 0);
rc = ftruncate(outfd, inlen);
count = 0;
while (count < inlen) {

View File

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

View File

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

View File

@ -93,6 +93,7 @@ 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;
@ -222,6 +223,7 @@ 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);

View File

@ -363,6 +363,7 @@ 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[] = {
@ -403,7 +404,7 @@ void loadKickstartModule(struct loaderData_s * loaderData,
args = g_strsplit(opts, " ", 0);
}
mlLoadModule(module, args);
rc = mlLoadModule(module, args);
g_strfreev(args);
return;
}

View File

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

View File

@ -78,30 +78,31 @@ telnet_negotiate(int socket, char ** term_type_ptr, int * heightPtr,
IAC DO NAWS
IAC SB TERMINAL_TYPE "\x01" IAC SE
;
int ret;
write(socket, request, sizeof(request)-1);
ret = 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 {
read(socket, &ch, 1);
ret = read(socket, &ch, 1);
if (ch != '\xff') {
abort();
}
read(socket, &ch, 1); /* command */
ret = read(socket, &ch, 1); /* command */
if (ch != '\xfa') {
read(socket, &ch, 1); /* verb */
ret = read(socket, &ch, 1); /* verb */
continue;
}
read(socket, &ch, 1); /* suboption */
ret = read(socket, &ch, 1); /* suboption */
if (ch == '\x18') {
state = ST_TERMTYPE;
read(socket, &ch, 1); /* should be 0x0! */
ret = read(socket, &ch, 1); /* should be 0x0! */
done = 1;
} else if (ch == '\x1f') {
state = ST_WINDOWSIZE;
@ -109,7 +110,7 @@ telnet_negotiate(int socket, char ** term_type_ptr, int * heightPtr,
state = ST_NONE;;
}
read(socket, &ch, 1); /* data */
ret = read(socket, &ch, 1); /* data */
while (ch != '\xff') {
if (state == ST_TERMTYPE) {
if (termAlloced == termLength) {
@ -123,10 +124,10 @@ telnet_negotiate(int socket, char ** term_type_ptr, int * heightPtr,
*sizePtr++ = ch;
}
read(socket, &ch, 1); /* data */
ret = read(socket, &ch, 1); /* data */
}
read(socket, &ch, 1); /* should be a SE */
ret = read(socket, &ch, 1); /* should be a SE */
} while (!done);
@ -253,6 +254,7 @@ 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 */
@ -267,5 +269,5 @@ telnet_send_output(int sock, char *data, int len) {
}
/* now send it... */
write(sock, buf, len);
ret = write(sock, buf, len);
}

View File

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

View File

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

View File

@ -29,13 +29,13 @@
int main(int argc, char ** argv) {
struct kmapHeader h;
struct kmapInfo info;
int i;
int i, x;
struct stat sb;
char * chptr;
h.magic = KMAP_MAGIC;
h.numEntries = argc - 1;
write(1, &h, sizeof(h));
x = 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;
write(1, &info, sizeof(info));
x = write(1, &info, sizeof(info));
}
return 0;

View File

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