Blob Blame History Raw
diff -Nur mt-st-1.1_old/debugfiles.list mt-st-1.1/debugfiles.list
--- mt-st-1.1_old/debugfiles.list	1970-01-01 08:00:00.000000000 +0800
+++ mt-st-1.1/debugfiles.list	2018-09-14 05:51:39.368918861 +0800
@@ -0,0 +1,8 @@
+%dir /usr/lib/debug
+%dir /usr/lib/debug/usr
+%dir /usr/lib/debug/usr/bin
+%dir /usr/lib/debug/usr/sbin
+%dir /usr/lib/debug/.dwz
+/usr/lib/debug/usr/bin/mt-1.1-22.fc28.x86_64.debug
+/usr/lib/debug/usr/sbin/stinit-1.1-22.fc28.x86_64.debug
+/usr/lib/debug/.dwz/mt-st-1.1-22.fc28.x86_64
diff -Nur mt-st-1.1_old/debugsourcefiles.list mt-st-1.1/debugsourcefiles.list
--- mt-st-1.1_old/debugsourcefiles.list	1970-01-01 08:00:00.000000000 +0800
+++ mt-st-1.1/debugsourcefiles.list	2018-09-14 05:51:39.371085528 +0800
@@ -0,0 +1 @@
+/usr/src/debug/mt-st-1.1-22.fc28.x86_64
Binary files mt-st-1.1_old/debugsources.list and mt-st-1.1/debugsources.list differ
diff -Nur mt-st-1.1_old/elfbins.list mt-st-1.1/elfbins.list
--- mt-st-1.1_old/elfbins.list	1970-01-01 08:00:00.000000000 +0800
+++ mt-st-1.1/elfbins.list	2018-09-14 05:51:39.341835530 +0800
@@ -0,0 +1,2 @@
+.//usr/bin/mt
+.//usr/sbin/stinit
diff -Nur mt-st-1.1_old/mt.c mt-st-1.1/mt.c
--- mt-st-1.1_old/mt.c	2018-09-13 12:19:35.156610050 +0800
+++ mt-st-1.1/mt.c	2018-09-14 05:52:08.509500057 +0800
@@ -280,7 +280,7 @@
 	int
 main(int argc, char **argv)
 {
-    int mtfd, cmd_code, i, argn, len, oflags;
+    int mtfd, i, argn, len, oflags;
     char *cmdstr;
     cmdef_tr *comp, *comp2;
 
@@ -351,7 +351,6 @@
 		comp->cmd_name);
 	exit(1);
     }
-    cmd_code = comp->cmd_code;
 
     if (comp->cmd_fdtype != NO_FD) {
 	oflags = comp->cmd_fdtype == FD_RDONLY ? O_RDONLY : O_RDWR;
@@ -390,23 +389,23 @@
 usage(int explain)
 {
     int ind;
-    char line[100];
+    int counter = 0;
 
     fprintf(stderr, "usage: mt [-v] [--version] [-h] [ -f device ] command [ count ]\n");
     if (explain) {
 	for (ind=0; cmds[ind].cmd_name != NULL; ) {
 	    if (ind == 0)
-		strcpy(line, "commands: ");
+		counter = fprintf(stderr, "commands: ");
 	    else
-		strcpy(line, "          ");
+		counter = fprintf(stderr, "          ");
 	    for ( ; cmds[ind].cmd_name != NULL; ind++) {
-		strcat(line, cmds[ind].cmd_name);
+		counter += fprintf(stderr, "%s", cmds[ind].cmd_name);
 		if (cmds[ind+1].cmd_name != NULL)
-		    strcat(line, ", ");
+		    counter += fprintf(stderr, ", ");
 		else
-		    strcat(line, ".");
-		if (strlen(line) >= 70 || cmds[ind+1].cmd_name == NULL) {
-		    fprintf(stderr, "%s\n", line);
+		    counter += fprintf(stderr, ".");
+		if (counter >= 70 || cmds[ind+1].cmd_name == NULL) {
+		    fprintf(stderr, "\n");
 		    ind++;
 		    break;
 		}
@@ -736,6 +735,8 @@
     if ((fd = open(fname, O_RDONLY)) < 0 ||
 	read(fd, buf, 20) < 0) {
 	fprintf(stderr, "Can't read the sysfs file '%s'.\n", fname);
+	if (fd >= 0)
+		close(fd);
 	return 2;
     }
     close(fd);
diff -Nur mt-st-1.1_old/stinit.c mt-st-1.1/stinit.c
--- mt-st-1.1_old/stinit.c	2018-09-13 12:19:35.151610044 +0800
+++ mt-st-1.1/stinit.c	2018-09-14 05:51:38.644168915 +0800
@@ -148,7 +148,7 @@
 		else
 		    for (cp2=cp+1; isalnum(*cp2) || *cp2 == '-'; cp2++)
 			;
-		if (cp2 == '\0')
+		if (*cp2 == '\0')
 		    return NULL;
 		have_arg = TRUE;
 		argp = cp;
@@ -349,8 +349,7 @@
 		continue;
 	    }
 
-	    strcpy(defstr, comptr);
-	    strcat(defstr, cp);
+	    snprintf(defstr, sizeof(defstr)/sizeof(char), "%s%s", comptr, cp);
 	    *nextdef = c;
 
 	    if (verbose > 1)
@@ -451,9 +450,6 @@
 
 static int sg_io_errcheck(struct sg_io_hdr *hdp)
 {
-    int status;
-
-    status = hdp->status & 0x7e;
     if ((hdp->status & 0x7e) == 0 || hdp->host_status == 0 ||
 	hdp->driver_status == 0)
 	return 0;