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

View File

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

View File

@ -149,7 +149,7 @@ static int mapBiosDisks(struct device** devices,const char *path) {
char * sigFileName; char * sigFileName;
uint32_t mbrSig, biosNum, currentSig; uint32_t mbrSig, biosNum, currentSig;
struct device **currentDev, **foundDisk; struct device **currentDev, **foundDisk;
int i, rc, dm_nr, highest_dm; int i, rc, ret, dm_nr, highest_dm;
dirHandle = opendir(path); dirHandle = opendir(path);
if(!dirHandle){ 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)) { if(!strncmp(entry->d_name,".",1) || !strncmp(entry->d_name,"..",2)) {
continue; 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); sigFileName = malloc(strlen(path) + strlen(entry->d_name) + 20);
sprintf(sigFileName, "%s/%s/%s", path, entry->d_name, SIG_FILE); sprintf(sigFileName, "%s/%s/%s", path, entry->d_name, SIG_FILE);
@ -332,8 +332,6 @@ char * getBiosDisk(char *biosStr) {
return NULL; return NULL;
ret = sscanf(biosStr,"%x",&biosNum); ret = sscanf(biosStr,"%x",&biosNum);
if (!ret)
return NULL;
disk = lookupHashItem(mbrSigToName, biosNum); disk = lookupHashItem(mbrSigToName, biosNum);
if (disk) return disk->diskname; 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) { static int strntoul(const char * str, char ** endptr, int base, int num) {
char * buf, * end; char * buf, * end;
unsigned long ret;
buf = alloca(num + 1); buf = alloca(num + 1);
strncpy(buf, str, num); strncpy(buf, str, num);
buf[num] = '\0'; buf[num] = '\0';
strtoul(buf, &end, base); ret = strtoul(buf, &end, base);
if (*end) if (*end)
*endptr = (char *)(str + (end - buf)); /* XXX discards const */ *endptr = (char *)(str + (end - buf)); /* XXX discards const */
else else
@ -490,6 +491,7 @@ int myCpioInstallArchive(gzFile stream, struct cpioFileMapping * mappings,
int linkNum = 0; int linkNum = 0;
struct cpioFileMapping * map = NULL; struct cpioFileMapping * map = NULL;
struct cpioFileMapping needle; struct cpioFileMapping needle;
mode_t cpioMode;
int olderr; int olderr;
struct cpioCallbackInfo cbInfo; struct cpioCallbackInfo cbInfo;
struct hardLink * links = NULL; struct hardLink * links = NULL;
@ -521,6 +523,8 @@ int myCpioInstallArchive(gzFile stream, struct cpioFileMapping * mappings,
if (mappings && !map) { if (mappings && !map) {
eatBytes(&fd, ch.size); eatBytes(&fd, ch.size);
} else { } else {
cpioMode = ch.mode;
if (map) { if (map) {
if (map->mapFlags & CPIO_MAP_PATH) { if (map->mapFlags & CPIO_MAP_PATH) {
free(ch.path); free(ch.path);

View File

@ -276,7 +276,7 @@ static int loadDriverDisk(struct loaderData_s *loaderData, char *mntpt) {
struct moduleBallLocation * location; struct moduleBallLocation * location;
struct stat sb; struct stat sb;
static int disknum = 0; static int disknum = 0;
int fd; int fd, ret;
/* check for new version */ /* check for new version */
sprintf(file, "%s/rhdd3", mntpt); sprintf(file, "%s/rhdd3", mntpt);
@ -288,7 +288,7 @@ static int loadDriverDisk(struct loaderData_s *loaderData, char *mntpt) {
title = malloc(sb.st_size + 1); title = malloc(sb.st_size + 1);
fd = open(file, O_RDONLY); 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') if (title[sb.st_size - 1] == '\n')
sb.st_size--; sb.st_size--;
title[sb.st_size] = '\0'; 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 chooseManualDriver(int class, struct loaderData_s *loaderData) {
int i, numSorted, num = 0, done = 0; int i, numSorted, num = 0, done = 0;
enum driverMajor type;
struct sortModuleList * sortedOrder; struct sortModuleList * sortedOrder;
char giveArgs = ' '; char giveArgs = ' ';
gchar **moduleArgs = NULL; gchar **moduleArgs = NULL;
@ -130,6 +131,13 @@ int chooseManualDriver(int class, struct loaderData_s *loaderData) {
newtGrid grid, buttons; newtGrid grid, buttons;
struct newtExitStruct es; 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 { do {
sortedOrder = malloc(sizeof(*sortedOrder) * modInfo->numModules); sortedOrder = malloc(sizeof(*sortedOrder) * modInfo->numModules);
numSorted = 0; 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) static int open_uevent_socket(struct fw_loader *fwl)
{ {
int fd; int fd, rc;
struct sockaddr_nl sa; struct sockaddr_nl sa;
fd = socket(PF_NETLINK, SOCK_DGRAM, NETLINK_KOBJECT_UEVENT); 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); fd = open("/proc/sys/kernel/hotplug", O_RDWR);
if (fd >= 0) { if (fd >= 0) {
ftruncate(fd, 0); rc = ftruncate(fd, 0);
write(fd, "\n", 1); rc = write(fd, "\n", 1);
close(fd); close(fd);
} }
fd = open("/sys/class/firmware/timeout", O_RDWR); fd = open("/sys/class/firmware/timeout", O_RDWR);
if (fd >= 0) { if (fd >= 0) {
write(fd, "10", 2); rc = write(fd, "10", 2);
close(fd); close(fd);
} }
@ -128,6 +128,7 @@ static void kill_hotplug_signal(int signum)
static int daemonize(struct fw_loader *fwl) static int daemonize(struct fw_loader *fwl)
{ {
int fd; int fd;
int rc;
signal(SIGTERM, kill_hotplug_signal); signal(SIGTERM, kill_hotplug_signal);
signal(SIGSEGV, loaderSegvHandler); signal(SIGSEGV, loaderSegvHandler);
@ -141,11 +142,11 @@ static int daemonize(struct fw_loader *fwl)
sigemptyset(&fwl->sigmask); sigemptyset(&fwl->sigmask);
prctl(PR_SET_NAME, "hotplug", 0, 0, 0); prctl(PR_SET_NAME, "hotplug", 0, 0, 0);
chdir("/"); rc = chdir("/");
fd = open("/proc/self/oom_adj", O_RDWR); fd = open("/proc/self/oom_adj", O_RDWR);
if (fd >= 0) { if (fd >= 0) {
write(fd, "-17", 3); rc = write(fd, "-17", 3);
close(fd); close(fd);
} }
@ -341,6 +342,7 @@ fetcher(char *inpath, int outfd)
size_t inlen; size_t inlen;
int count; int count;
int en = 0; int en = 0;
int rc;
errno = 0; errno = 0;
if (access(inpath, F_OK)) if (access(inpath, F_OK))
@ -350,8 +352,8 @@ fetcher(char *inpath, int outfd)
goto out; goto out;
lseek(outfd, 0, SEEK_SET); lseek(outfd, 0, SEEK_SET);
ftruncate(outfd, 0); rc = ftruncate(outfd, 0);
ftruncate(outfd, inlen); rc = ftruncate(outfd, inlen);
count = 0; count = 0;
while (count < inlen) { while (count < inlen) {

View File

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

View File

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

View File

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

View File

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

View File

@ -49,6 +49,7 @@ static void performTerminations(void) {
} }
static void performUnmounts(void) { static void performUnmounts(void) {
int ignore;
printf("disabling swap...\n"); printf("disabling swap...\n");
disableSwap(); disableSwap();
@ -57,7 +58,7 @@ static void performUnmounts(void) {
unmountFilesystems(); unmountFilesystems();
printf("waiting for mdraid sets to become clean...\n"); 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) { 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 DO NAWS
IAC SB TERMINAL_TYPE "\x01" IAC SE 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 /* 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 do bad things if the client doesn't send the terminal type, but
those clients have existed for aeons (right?) */ those clients have existed for aeons (right?) */
do { do {
read(socket, &ch, 1); ret = read(socket, &ch, 1);
if (ch != '\xff') { if (ch != '\xff') {
abort(); abort();
} }
read(socket, &ch, 1); /* command */ ret = read(socket, &ch, 1); /* command */
if (ch != '\xfa') { if (ch != '\xfa') {
read(socket, &ch, 1); /* verb */ ret = read(socket, &ch, 1); /* verb */
continue; continue;
} }
read(socket, &ch, 1); /* suboption */ ret = read(socket, &ch, 1); /* suboption */
if (ch == '\x18') { if (ch == '\x18') {
state = ST_TERMTYPE; state = ST_TERMTYPE;
read(socket, &ch, 1); /* should be 0x0! */ ret = read(socket, &ch, 1); /* should be 0x0! */
done = 1; done = 1;
} else if (ch == '\x1f') { } else if (ch == '\x1f') {
state = ST_WINDOWSIZE; state = ST_WINDOWSIZE;
@ -109,7 +110,7 @@ telnet_negotiate(int socket, char ** term_type_ptr, int * heightPtr,
state = ST_NONE;; state = ST_NONE;;
} }
read(socket, &ch, 1); /* data */ ret = read(socket, &ch, 1); /* data */
while (ch != '\xff') { while (ch != '\xff') {
if (state == ST_TERMTYPE) { if (state == ST_TERMTYPE) {
if (termAlloced == termLength) { if (termAlloced == termLength) {
@ -123,10 +124,10 @@ telnet_negotiate(int socket, char ** term_type_ptr, int * heightPtr,
*sizePtr++ = ch; *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); } while (!done);
@ -253,6 +254,7 @@ void
telnet_send_output(int sock, char *data, int len) { telnet_send_output(int sock, char *data, int len) {
char *s, *d; /* source, destination */ char *s, *d; /* source, destination */
char *buf; char *buf;
int ret;
buf = alloca((len*2)+1); /* max necessary size */ buf = alloca((len*2)+1); /* max necessary size */
@ -267,5 +269,5 @@ telnet_send_output(int sock, char *data, int len) {
} }
/* now send it... */ /* 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) { if (fds[1].revents) {
int ret;
i = read(conn, buf, sizeof(buf)); i = read(conn, buf, sizeof(buf));
/* connection went away */ /* connection went away */
@ -176,7 +177,7 @@ int beTelnet(void) {
break; break;
i = telnet_process_input(&ts, buf, i); i = telnet_process_input(&ts, buf, i);
write(masterFd, buf, i); ret = write(masterFd, buf, i);
#ifdef DEBUG_TELNET #ifdef DEBUG_TELNET
{ {
int j; int j;

View File

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

View File

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

View File

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