View | Details | Raw Unified
Collapse All | Expand All

(-) ../eject-2.0.13.old/eject.c (-6 / +16 lines)
 Lines 69-74    Link Here 
#include <scsi/sg.h>
#include <scsi/sg.h>
#include <scsi/scsi_ioctl.h>
#include <scsi/scsi_ioctl.h>
#define CLOSE(fd) if (close(fd)==-1) { \
    perror(programName); \
    exit(1); \
}
#define FCLOSE(fd) if (fclose(fd)==-1) { \
    perror(programName); \
    exit(1); \
}
/* Global Variables */
/* Global Variables */
const char *version = VERSION; /* program version */
const char *version = VERSION; /* program version */
int a_option = 0; /* command flags and arguments */
int a_option = 0; /* command flags and arguments */
 Lines 627-633    Link Here 
			GetMajorMinor(s1, &mtabmaj, &mtabmin);
			GetMajorMinor(s1, &mtabmaj, &mtabmin);
			if (((strcmp(s1, name) == 0) || (strcmp(s2, name) == 0)) ||
			if (((strcmp(s1, name) == 0) || (strcmp(s2, name) == 0)) ||
				((maj != -1) && (maj == mtabmaj) && (min == mtabmin))) {
				((maj != -1) && (maj == mtabmaj) && (min == mtabmin))) {
				fclose(fp);
				FCLOSE(fp);
				*deviceName = strdup(s1);
				*deviceName = strdup(s1);
				*mountName = strdup(s2);
				*mountName = strdup(s2);
				return 1;
				return 1;
 Lines 636-642    Link Here 
	}
	}
	*deviceName = 0;
	*deviceName = 0;
	*mountName = 0;
	*mountName = 0;
	fclose(fp);
	FCLOSE(fp);
	return 0;
	return 0;
}
}
 Lines 663-675    Link Here 
	while (fgets(line, sizeof(line), fp) != 0) {
	while (fgets(line, sizeof(line), fp) != 0) {
		rc = sscanf(line, "%1023s %1023s", s1, s2);
		rc = sscanf(line, "%1023s %1023s", s1, s2);
		if (rc >= 2 && s1[0] != '#' && strcmp(s2, name) == 0) {
		if (rc >= 2 && s1[0] != '#' && strcmp(s2, name) == 0) {
			fclose(fp);
			FCLOSE(fp);
			*deviceName = strdup(s1);
			*deviceName = strdup(s1);
			*mountName = strdup(s2);
			*mountName = strdup(s2);
			return 1;
			return 1;
		}
		}
	}
	}
	fclose(fp);
	FCLOSE(fp);
	return 0;
	return 0;
}
}
 Lines 708-714    Link Here 
			}
			}
		}
		}
	}
	}
	fclose(fp);
	FCLOSE(fp);
}
}
 Lines 1018-1024    Link Here 
	}
	}
	/* cleanup */
	/* cleanup */
	close(fd);
	CLOSE(fd);
	free(device);
	free(device);
	free(deviceName);
	free(deviceName);
	free(fullName);
	free(fullName);