files.c (dc9523b7) files.c (2fbb987b)
1/*-
2 * Copyright (c) 2010, 2013 The NetBSD Foundation, Inc.
3 * All rights reserved.
4 *
5 * This code is derived from software contributed to The NetBSD Foundation
6 * by David A. Holland.
7 *
8 * Redistribution and use in source and binary forms, with or without

--- 299 unchanged lines hidden (view full) ---

308 dlen = strlen(dir);
309 flen = strlen(file);
310 if (dlen > 0 && dir[dlen-1] != '/') {
311 needslash = true;
312 }
313
314 rlen = dlen + (needslash ? 1 : 0) + flen;
315 ret = domalloc(rlen + 1);
1/*-
2 * Copyright (c) 2010, 2013 The NetBSD Foundation, Inc.
3 * All rights reserved.
4 *
5 * This code is derived from software contributed to The NetBSD Foundation
6 * by David A. Holland.
7 *
8 * Redistribution and use in source and binary forms, with or without

--- 299 unchanged lines hidden (view full) ---

308 dlen = strlen(dir);
309 flen = strlen(file);
310 if (dlen > 0 && dir[dlen-1] != '/') {
311 needslash = true;
312 }
313
314 rlen = dlen + (needslash ? 1 : 0) + flen;
315 ret = domalloc(rlen + 1);
316 strcpy(ret, dir);
317 if (needslash) {
318 strcat(ret, "/");
319 }
320 strcat(ret, file);
316 snprintf(ret, rlen+1, "%s%s%s", dir, needslash ? "/" : "", file);
321 return ret;
322}
323
324static
325int
326file_tryopen(const char *file)
327{
328 int fd;

--- 92 unchanged lines hidden ---
317 return ret;
318}
319
320static
321int
322file_tryopen(const char *file)
323{
324 int fd;

--- 92 unchanged lines hidden ---