← Commit list

908546797

Rob Landley
Rob Landley
2005-12-21
SOURCE BUG Duration: 9s

Subject

Trying to losetup a device as a regular user shouldn't result in an endless loop, and the error messages should display correctly now.

SOURCE BUG

This commit was genuinely broken at the time (not related to our build system): scripts/config/mkconfigs.c (2005-08-01 - 2006-10-05 arasi) uretilen bbconfigopts.h icine .config satirlarini kacissiz, ham newline'larla gömüyordu - gecerli C degildi, busybox'un kendi bb_mkdep araci bile parse edemiyordu (7d219aab7 ile duzeltildi, mkconfigs shell scripte cevrildi)

→ Bu hatanin tam hikayesini ve duzeltme diffini gor

Binary

No binary (build failed)

Architecture & Compiler Flags

Architecture: x86_64-linux-gnu Compiler: gcc (Ubuntu 11.4.0-1ubuntu1~22.04.3) 11.4.0

—

Build Log

(log yok)

Commit Diff GitHub →

libbb/loop.c+3 -2
@@ -89,7 +89,7 @@ int set_loop(char **device, const char *file, int offset)
char dev[20], *try;
bb_loop_info loopinfo;
struct stat statbuf;
- int i, dfd, ffd, mode, rc=1;
+ int i, dfd, ffd, mode, rc=-1;
/* Open the file. Barf if this doesn't work. */
if((ffd = open(file, mode=O_RDWR))<0 && (ffd = open(file,mode=O_RDONLY))<0)
@@ -107,7 +107,7 @@ int set_loop(char **device, const char *file, int offset)
/* Open the sucker and check its loopiness. */
if((dfd=open(try, mode))<0 && errno==EROFS)
dfd=open(try,mode=O_RDONLY);
- if(dfd<0) continue;
+ if(dfd<0) goto try_again;
rc=ioctl(dfd, BB_LOOP_GET_STATUS, &loopinfo);
@@ -128,6 +128,7 @@ int set_loop(char **device, const char *file, int offset)
} else if(strcmp(file,loopinfo.lo_file_name)
|| offset!=loopinfo.lo_offset) rc=-1;
close(dfd);
+try_again:
if(*device) break;
}
close(ffd);