View | Details | Raw Unified | Return to issue 85381
Collapse All | Expand All

(-)dmake/make.c (-15 / +15 lines)
Lines 166-172 Link Here
166
      len=cell->len;
166
      len=cell->len;
167
#else
167
#else
168
      /* For cygwin with .WINPATH set the lenght of the converted
168
      /* For cygwin with .WINPATH set the lenght of the converted
169
       * filepaths might me longer. Extra checking is needed ... */
169
       * filepaths might be longer. Extra checking is needed ... */
170
      tpath = DO_WINPATH(cell->datum);
170
      tpath = DO_WINPATH(cell->datum);
171
      if( tpath == cell->datum ) {
171
      if( tpath == cell->datum ) {
172
	 len=cell->len;
172
	 len=cell->len;
Lines 174-199 Link Here
174
      else {
174
      else {
175
	 /* ... but only if DO_WINPATH() did something. */
175
	 /* ... but only if DO_WINPATH() did something. */
176
	 len = strlen(tpath);
176
	 len = strlen(tpath);
177
      
178
	 if( len > slen_rest ) {
179
	    /* We need more memory. As DOS paths are usually shorter than the
180
	     * original cygwin POSIX paths (exception mounted paths) this should
181
	     * rarely happen. */
182
	    int p_offset = p - result;
183
	    /* Get more than needed. */
184
	    slen += slen + len-slen_rest + 128;
185
	    if((result = realloc( result, (unsigned)(slen*sizeof(char)) ) ) == NULL)
186
	       No_ram();
187
	    p = result + p_offset;
188
	 }
189
      }
177
      }
190
178
      if( len >= slen_rest ) {
191
      slen_rest -= len;
179
	 /* We need more memory. As DOS paths are usually shorter than the
180
	  * original cygwin POSIX paths (exception mounted paths) this should
181
	  * rarely happen. */
182
	 int p_offset = p - result;
183
	 /* Get more than needed. */
184
	 slen = slen + len - slen_rest + 128;
185
	 if((result = realloc( result, slen ) ) == NULL)
186
	    No_ram();
187
	 p = result + p_offset;
188
      }
192
#endif
189
#endif
193
190
194
      memcpy((void *)p, (void *)tpath, len);
191
      memcpy((void *)p, (void *)tpath, len);
195
      p += len;
192
      p += len;
196
      *p++ = ' ';
193
      *p++ = ' ';
194
195
      slen_rest = slen - (p - result);
196
197
      next = cell->next;
197
      next = cell->next;
198
      free_cell(cell);
198
      free_cell(cell);
199
   }
199
   }

Return to issue 85381