Diff

Differences From Artifact [72840611b5]:

To Artifact [430cff4a7a]:


    52     52   	char name[256];
    53     53   };
    54     54   
    55     55   struct appfs_pathinfo {
    56     56   	appfs_pathtype_t type;
    57     57   	time_t time;
    58     58   	char hostname[256];
           59  +	int packaged;
    59     60   	unsigned long long inode;
    60     61   	union {
    61     62   		struct {
    62     63   			int childcount;
    63     64   		} dir;
    64     65   		struct {
    65     66   			int executable;
................................................................................
   742    743   	char *hostname, *packagename, *os_cpuArch, *os, *cpuArch, *version;
   743    744   	char *path, *path_s;
   744    745   	char *package_hash;
   745    746   	char *sql;
   746    747   	int files_count;
   747    748   	int fileinfo_ret, retval;
   748    749   
          750  +	/* Initialize return */
   749    751   	if (children) {
   750    752   		*children = NULL;
   751    753   	}
   752    754   
          755  +	/* Verify that this is a valid request */
   753    756   	if (_path == NULL) {
   754    757   		return(-ENOENT);
   755    758   	}
   756    759   
   757    760   	if (_path[0] != '/') {
   758    761   		return(-ENOENT);
   759    762   	}
          763  +
          764  +	/* Note that this is not a "real" directory from a package */
          765  +	pathinfo->packaged = 0;
   760    766   
   761    767   	if (_path[1] == '\0') {
   762    768   		/* Request for the root directory */
   763    769   		pathinfo->hostname[0] = '\0';
   764    770   		pathinfo->inode = 1;
   765    771   
   766    772   		sql = sqlite3_mprintf("SELECT DISTINCT hostname FROM packages;");
................................................................................
   874    880   		path = "";
   875    881   	} else {
   876    882   		*path = '\0';
   877    883   		path++;
   878    884   	}
   879    885   
   880    886   	/* Request for a file in a specific package */
          887  +	pathinfo->packaged = 1;
   881    888   	APPFS_DEBUG("Requesting information for hostname = %s, package = %s, os = %s, cpuArch = %s, version = %s, path = %s", 
   882    889   		hostname, packagename, os, cpuArch, version, path
   883    890   	);
   884    891   
   885    892   	package_hash = appfs_lookup_package_hash(hostname, packagename, os, cpuArch, version);
   886    893   	if (package_hash == NULL) {
   887    894   		free(path_s);
................................................................................
   993   1000   			break;
   994   1001   		case APPFS_PATHTYPE_INVALID:
   995   1002   			res = -EIO;
   996   1003   
   997   1004   			break;
   998   1005   	}
   999   1006   
  1000         -	if (globalThread.options.writable) {
  1001         -		stbuf->st_mode |= 0222;
         1007  +	if (pathinfo.packaged) {
         1008  +		if (globalThread.options.writable) {
         1009  +			stbuf->st_mode |= 0222;
         1010  +		}
  1002   1011   	}
  1003   1012   
  1004   1013   	return res;
  1005   1014   }
  1006   1015   
  1007   1016   static int appfs_fuse_readdir(const char *path, void *buf, fuse_fill_dir_t filler, off_t offset, struct fuse_file_info *fi) {
  1008   1017   	struct appfs_pathinfo pathinfo;