syscalls.c (09bf11699fec5fab131b12aabed54e36fae688f7) syscalls.c (7c8225cab891cbee9c36fd4abf3d6d6eb212fe9c)
1/*
2 * Copryight 1997 Sean Eric Fagan
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.

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

132 char *pos;
133 FILE *p;
134 int c, fd;
135
136 if ((fd = dup(procfd)) == -1)
137 err(1, "dup");
138 if ((p = fdopen(fd, "r")) == NULL)
139 err(1, "fdopen");
1/*
2 * Copryight 1997 Sean Eric Fagan
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.

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

132 char *pos;
133 FILE *p;
134 int c, fd;
135
136 if ((fd = dup(procfd)) == -1)
137 err(1, "dup");
138 if ((p = fdopen(fd, "r")) == NULL)
139 err(1, "fdopen");
140 fseek(p, (long)offset, SEEK_SET);
140 fseeko(p, (uintptr_t)offset, SEEK_SET);
141 for (pos = (char *)buf; len--; pos++) {
142 if ((c = fgetc(p)) == EOF)
143 return -1;
144 *pos = c;
145 }
146 fclose(p);
147 return 0;
148}

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

162
163 if ((fd = dup(procfd)) == -1)
164 err(1, "dup");
165 if ((p = fdopen(fd, "r")) == NULL)
166 err(1, "fdopen");
167 buf = malloc( size = (max ? max : 64 ) );
168 len = 0;
169 buf[0] = 0;
141 for (pos = (char *)buf; len--; pos++) {
142 if ((c = fgetc(p)) == EOF)
143 return -1;
144 *pos = c;
145 }
146 fclose(p);
147 return 0;
148}

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

162
163 if ((fd = dup(procfd)) == -1)
164 err(1, "dup");
165 if ((p = fdopen(fd, "r")) == NULL)
166 err(1, "fdopen");
167 buf = malloc( size = (max ? max : 64 ) );
168 len = 0;
169 buf[0] = 0;
170 fseek(p, (long)offset, SEEK_SET);
170 fseeko(p, (uintptr_t)offset, SEEK_SET);
171 while ((c = fgetc(p)) != EOF) {
172 buf[len++] = c;
173 if (c == 0 || len == max) {
174 buf[len] = 0;
175 break;
176 }
177 if (len == size) {
178 char *tmp;

--- 202 unchanged lines hidden ---
171 while ((c = fgetc(p)) != EOF) {
172 buf[len++] = c;
173 if (c == 0 || len == max) {
174 buf[len] = 0;
175 break;
176 }
177 if (len == size) {
178 char *tmp;

--- 202 unchanged lines hidden ---